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
|
FROM ubuntu:xenial
# create non-root user
RUN useradd -m -u 1000 ubuntu
# prepare application workdir
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# install system dependencies (debs)
RUN apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository --yes --update ppa:ubuntuone/isitdeployable-dependencies \
&& apt-get upgrade -y
COPY dependencies.txt.docker ./
RUN apt-get update \
&& cat dependencies.txt.docker | xargs apt-get install -y --no-install-recommends \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install python dependencies (wheels)
COPY branches/wheels ./branches/wheels
COPY requirements.txt .
RUN pip install --find-links=branches/wheels --no-index -r requirements.txt
# add app source code
COPY . ./
# make files writable by non-root user
RUN chown -R ubuntu:ubuntu /usr/src/app
# switch to non-root user
USER ubuntu
# start container
CMD ["make", "app-start"]
|