-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (37 loc) · 1.36 KB
/
Dockerfile
File metadata and controls
45 lines (37 loc) · 1.36 KB
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
FROM python:3.10-alpine
LABEL maintainer="Mario Ramirez marm1984@gmail.com"
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /tmp/requirements.txt
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
COPY ./scripts /scripts
COPY ./app /app
WORKDIR /app
EXPOSE 8000
ARG DEV=false
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
apk add --update --no-cache postgresql-client && \
apk add --update --no-cache --virtual .tmp-build-dev \
build-base postgresql-dev musl-dev linux-headers && \
apk add --update --no-cache graphviz && \
apk add --update --no-cache graphviz-dev && \
/py/bin/pip install -r /tmp/requirements.txt && \
if [ "$DEV" = "true" ] ; then /py/bin/pip install -r /tmp/requirements.dev.txt ; fi && \
rm -rf /tmp && \
apk del .tmp-build-dev && \
adduser \
--disabled-password \
--no-create-home \
django-user && \
mkdir -p /vol/media && \
mkdir -p /vol/static && \
mkdir -p /opt/web_tracker/security_scripts && \
chown -R django-user:django-user /vol && \
chmod -R 755 /vol && \
chmod -R +x /scripts && \
chown -R django-user:django-user /opt/web_tracker/security_scripts
COPY ./security_scripts /opt/web_tracker/security_scripts
RUN chmod -R 755 /opt/web_tracker/security_scripts/manage_patterns.py
ENV PATH="/scripts:/py/bin:$PATH"
USER django-user
CMD ["run.sh"]