-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
53 lines (42 loc) · 1.8 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
FROM python:3.6-slim
RUN apt-get clean && apt-get update \
&& apt-get install -y locales
# Upgrade to the latest pip.
RUN pip install pip==19.1.1
# Put all of our files in an application-specific directory.
WORKDIR app
# Only copy the requirements file before installing requirements so that
# updating our Python code doesn't force the requirements to be reinstalled.
COPY src/requirements.txt src/
# In our Docker image, we want to install pinned requirements for
# reproducibility, so install the concrete requirements prior to installing
# from setup.py.
# Consequently, installing from setup.py below shouldn't result in
# installing any additional packages aside from the orr project itself.
# This is because pip should find already installed all the requirements
# listed in install_requires.
RUN pip install -r src/requirements.txt
COPY debian/ debian/
# Install locales.
RUN cp debian/locale.gen /etc/locale.gen \
&& locale-gen \
# Display all installed locales to simplify troubleshooting.
&& locale -a
COPY sampledata/ sampledata/
COPY scripts/ scripts/
COPY src/ src/
# Copy the submodules directory since it contains the translations.json
# file needed for our template rendering.
COPY submodules/ submodules/
COPY templates/ templates/
# Add a marker file so we can check from within Python whether we
# are running inside the Docker container.
RUN touch src/orr/in_docker.py
# Installing via pip lets us invoke the program using the console-script
# entry-point "orr" defined in setup.py.
RUN pip install ./src
# Pass --output-fresh-parent as a check to ensure that the parent
# of the output directory is empty when running using Docker.
# This way we know we're copying only one directory when we run--
# $ docker cp orr_builder:/app/_build/. _build
ENTRYPOINT ["orr", "--output-fresh-parent"]