forked from pwmarcz/zeus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (43 loc) · 1.13 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
#####
# zeus_dev (for mounting the source code)
#####
FROM ubuntu:20.04 AS zeus_dev
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && apt-get -yy install \
build-essential \
python3.8 \
python3.8-dev \
python3-venv \
libgmp-dev \
libmpfr-dev \
libmpc-dev \
postgresql-client-12 \
moreutils \
gettext
RUN useradd --create-home --shell /bin/bash user
USER user
WORKDIR /home/user
# Create and activate virtualenv
ENV VIRTUAL_ENV=/home/user/env
RUN python3.8 -m venv "$VIRTUAL_ENV"
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN mkdir zeus
WORKDIR /home/user/zeus
# Install Python packages
COPY --chown=user:user requirements.txt .
RUN pip install -r requirements.txt
EXPOSE 8000
#####
# zeus_prod (source code copied, files built)
#####
FROM zeus_dev AS zeus_prod
# Copy the rest of Zeus sources
COPY --chown=user:user . .
# Use 'settings.prod' as default Django settings, docker-compose-prod.yml will
# override it
ENV DJANGO_SETTINGS_MODULE=settings.prod
# Compile translations
RUN ./compile-translations.sh
# Collect static files
RUN python manage.py collectstatic --noinput