-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
55 lines (42 loc) · 2.18 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# We start from latest Ubuntu LTS (18.04)
FROM ubuntu:bionic
# We install all the various tools needed to build the various artifacts
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
# System/dev utilities
sudo nano vim curl wget apt-transport-https ca-certificates gnupg-agent software-properties-common \
# Python for the various AWS CLI tools
python-dev python-wheel python-pip \
# JDK for the Java-based components
openjdk-8-jdk-headless \
# Dependencies for the preceeding tools
git groff \
# Docker client for building images
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get install -y docker-ce-cli
# Install npm, node
RUN cd /usr/local/lib && curl -s https://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.xz | tar xvJ && mv node-v10.15.1-linux-x64 node
# Make necessary symbolic links
RUN ln -s /usr/local/lib/node/bin/npm /usr/local/bin/npm \
&& ln -s /usr/local/lib/node/bin/node /usr/local/bin/node \
&& ln -s /usr/local/lib/node/bin/npx /usr/local/bin/npx
# We install AWS SAM CLI to build and deploy the various lambdas
RUN pip install --system awscli aws-sam-cli
# We install Yarn for JS tests
RUN curl -vsL https://github.com/yarnpkg/yarn/releases/download/v1.16.0/yarn_1.16.0_all.deb -o /tmp/yarn.deb && ls -l /tmp && dpkg -i /tmp/yarn.deb && rm /tmp/yarn.deb
# We create the build user environment
RUN useradd -rm -d /home/builder -s /bin/bash -g root -G sudo -u 1000 builder
RUN echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER builder
WORKDIR /home/builder
# We add the entry point
ADD scripts/docker/entrypoint /home/builder/entrypoint
# We make sure all the utilities we need are available
RUN make --version && docker --version && java -version && node --version && npm --version && python --version && aws --version && sam --version
# We mount the various volumes we care about
VOLUME /var/tmp/cache
VOLUME /home/builder/src
# We start in the source directory
WORKDIR /home/builder/src
# We run the entry point script
ENTRYPOINT /home/builder/entrypoint