-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
executable file
·66 lines (53 loc) · 1.69 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
64
65
66
FROM debian:jessie
ENV EDCTF_USER edctf
ENV EDCTF_DIR /opt/edctf
ENV EDCTF_CONFIG ${EDCTF_DIR}/config
ENV EDCTF_DJANGO ${EDCTF_DIR}/edctf
ENV EDCTF_EMBER ${EDCTF_DIR}/ember
ENV EDCTF_SCRIPTS ${EDCTF_DIR}/scripts
# Install packages
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get -y install \
apache2 \
libapache2-mod-wsgi \
libpq-dev \
postgresql=9.4* \
python-pip \
python-dev \
sudo \
openssl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY scripts/requirements.txt requirements.txt
RUN pip install -r requirements.txt
# Create directory structure
RUN mkdir ${EDCTF_DIR} \
&& mkdir ${EDCTF_SCRIPTS}
# Add environment variables script
COPY scripts/environment.bash ${EDCTF_SCRIPTS}/environment.bash
#Copy Django base
COPY edctf ${EDCTF_DJANGO}
# Copy frontend
COPY ember ${EDCTF_EMBER}
COPY scripts/build_frontend-prod.bash ${EDCTF_SCRIPTS}/build_frontend-prod.bash
# Build frontend css
RUN /bin/bash -c "source ${EDCTF_SCRIPTS}/environment.bash \
&& ${EDCTF_SCRIPTS}/build_frontend-prod.bash"
# Copy backend
COPY manage.py ${EDCTF_DIR}/manage.py
COPY config ${EDCTF_CONFIG}
COPY scripts/generate_secrets.py ${EDCTF_SCRIPTS}/generate_secrets.py
COPY scripts/build_backend.bash ${EDCTF_SCRIPTS}/build_backend.bash
# Build backend
RUN /bin/bash -c "source ${EDCTF_SCRIPTS}/environment.bash \
&& /etc/init.d/postgresql start \
&& ${EDCTF_SCRIPTS}/build_backend.bash \
&& /etc/init.d/postgresql stop"
# Add container start script
COPY scripts/start-docker.bash ${EDCTF_SCRIPTS}/start-docker.bash
WORKDIR ${EDCTF_DIR}
EXPOSE 80
EXPOSE 443
ENTRYPOINT ["scripts/start-docker.bash"]