-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (28 loc) · 1.12 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
FROM python:3.7-slim-buster
# TODO: create a non root user for the app to run as
# Install c dependencies first as these rarely change and we can take advantage
# of caching to keep builds quick.
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# rm -rf cleans up a bunch of files apt-get leaves during installs that are unnecessary.
RUN mkdir /etc/uwsgi
RUN mkdir /code
WORKDIR /code
# By copying requirements over prior to upgrading pip/wheel/setuptools
# we will cause those packages to be upgraded every time requirements.txt changes
# if requirements.txt doesn't change then the subsequent layers will stay cached
# an builds will be quick.
COPY src/requirements.txt .
RUN python3.7 -m pip install --upgrade \
pip \
setuptools \
wheel
RUN python3.7 -m pip install -r requirements.txt
# This is almost alway going to invalidate the Docker cache so we should try and put it last
# the commands that follow may get invalidated but their short enough it really doesn't matter.
COPY src .
EXPOSE 5000
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["run"]