-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
100 lines (77 loc) · 2.67 KB
/
Copy pathDockerfile
File metadata and controls
100 lines (77 loc) · 2.67 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# pull main python image
FROM python:3.12-slim
# adding labels
LABEL Author="Cursion" Support="hello@cursion.dev"
# setting ENVs and Configs
ENV HOME=/app
ENV XDG_CACHE_HOME=$HOME/.cache
ENV DOCKERIZED=yes
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV MOZ_NO_REMOTE=1
ENV MOZ_DISABLE_AUTO_SAFE_MODE=1
ENV PYTHONPATH="$HOME:$PYTHONPATH"
ENV DJANGO_ALLOWED_HOSTS="*"
ENV SECRET_KEY="abcdefghijklmno123456789"
# create the app user
RUN addgroup --system app && adduser --system app
# Clean cache to avoid issues
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# installing system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-client \
gcc \
make \
gfortran \
libpq-dev \
openssl \
curl \
ca-certificates \
gnupg
# installing firefox-esr
RUN apt-get update && apt-get install -y --no-install-recommends firefox-esr
# installing google-chrome-stable
RUN curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
rm google-chrome-stable_current_amd64.deb
# installing microsoft-edge-stable
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ && \
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > \
/etc/apt/sources.list.d/microsoft-edge.list' && \
apt-get update && apt-get install -y microsoft-edge-stable
# installing node and npm
RUN curl -fsSL https://deb.nodesource.com/setup_current.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
npm install -g --no-cache n && \
n lts
# installing lighthouse & lighthouse-plugin-crux
RUN npm install -g lighthouse lighthouse-plugin-crux
# copying & installing requirements
COPY ./setup/requirements/requirements.txt /requirements.txt
RUN python3.12 -m pip install -r /requirements.txt
# setting working dir
COPY ./app /app
WORKDIR /app
# setting browser cache dirs
RUN mkdir -p .mozilla .cache
# setting ownership
RUN chown -R app:app /app
RUN chown -R app:app /usr/local/bin/lighthouse
# writing migrations file
RUN python3.12 manage.py makemigrations --no-input
# collecting static assets
RUN python3.12 manage.py collectstatic --no-input
# cleaning up
RUN apt-get clean && rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
microsoft.gpg
# setting final user
USER app
# copy healthcheck.sh
COPY ./setup/scripts/healthcheck.sh "/healthcheck.sh"
# staring up services
COPY ./setup/scripts/entrypoint.sh "/entrypoint.sh"
ENTRYPOINT [ "/entrypoint.sh" ]