-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
63 lines (44 loc) · 1.71 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
56
57
58
59
60
61
62
63
# ==============================
FROM registry.access.redhat.com/ubi8/python-38 as appbase
# ==============================
ENV PYTHONUNBUFFERED 1
USER 0
WORKDIR /app
RUN mkdir /entrypoint
COPY --chown=1001:1001 requirements.txt /app/requirements.txt
COPY --chown=1001:1001 requirements-prod.txt /app/requirements-prod.txt
RUN yum update -y && yum install -y \
nc \
&& pip install -U pip \
&& pip install --no-cache-dir -r /app/requirements.txt \
&& pip install --no-cache-dir -r /app/requirements-prod.txt
COPY --chown=1001:1001 docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
ENTRYPOINT ["/entrypoint/docker-entrypoint.sh"]
# ==============================
FROM appbase as staticbuilder
# ==============================
ENV VAR_ROOT /app
COPY --chown=1001:1001 . /app
RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic --noinput
# ==============================
FROM appbase as development
# ==============================
# Install poppler-utils to get pdftotext, which is used in tests
RUN yum install -y poppler-utils
COPY --chown=1001:1001 requirements-dev.txt /app/requirements-dev.txt
RUN pip install --no-cache-dir -r /app/requirements-dev.txt
ENV DEV_SERVER=1
COPY --chown=1001:1001 . /app/
# required to make compilemessages command work in OpenShift
RUN chmod -R g+w /app/locale && chgrp -R root /app/locale
USER 1001
EXPOSE 8081/tcp
# ==============================
FROM appbase as production
# ==============================
COPY --from=staticbuilder --chown=1001:1001 /app/static /app/static
COPY --chown=1001:1001 . /app/
# required to make compilemessages command work in OpenShift
RUN chmod -R g+w /app/locale && chgrp -R root /app/locale
USER 1001
EXPOSE 8000/tcp