-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
31 lines (23 loc) · 1.18 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
FROM python:3.10.0-slim-buster@sha256:e1a4ac2bab8832082f8e9ed2f9926dc8c7208d963eeb8553194b283f90f0afc8
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends libpq-dev wget build-essential \
&& wget -q https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -P /usr/local/bin \
&& chmod +x /usr/local/bin/wait-for-it.sh \
&& mkdir -p /app \
&& useradd -u 901 -r emeis --create-home \
# all project specific folders need to be accessible by newly created user but also for unknown users (when UID is set manually). Such users are in group root.
&& chown -R emeis:root /home/emeis \
&& chmod -R 770 /home/emeis
# needs to be set for users with manually set UID
ENV HOME=/home/emeis
ENV PYTHONUNBUFFERED=1
ENV DJANGO_SETTINGS_MODULE emeis.settings
ENV APP_HOME=/app
ENV UWSGI_INI /app/uwsgi.ini
ARG REQUIREMENTS=requirements-prod.txt
COPY requirements-base.txt requirements-prod.txt requirements-dev.txt $APP_HOME/
RUN pip install --upgrade --no-cache-dir --requirement $REQUIREMENTS --disable-pip-version-check
USER emeis
COPY . $APP_HOME
EXPOSE 8000
CMD /bin/sh -c "wait-for-it.sh $DATABASE_HOST:${DATABASE_PORT:-5432} -- ./manage.py migrate && uwsgi"