-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
42 lines (33 loc) · 1.35 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
FROM python:3.12.1-slim@sha256:c127a8c4aca8a5d3ac3a333cbab4c082c7ddbd0891441cc4e30d88dc351f1ce5
LABEL org.opencontainers.image.authors="Ken Shibata <[email protected]>, Kyunghan (Paul) Lee <[email protected]>, Jason Cameron <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/wlmac/metropolis"
ENV PYTHONDONTWRITEBYTECODE 1 # db.sqlite3D
ENV PYTHONUNBUFFERED 1
# Install system dependencies
RUN adduser --system --home /app --gecos "Metropolis" app && \
groupadd app && \
usermod -g app app && \
apt-get update && \
apt-get install -y build-essential python3-dev libpq-dev libffi-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app2/media
WORKDIR /app2/static
WORKDIR /app
USER app
COPY poetry.lock pyproject.toml /app/
RUN python -m pip install --no-cache-dir poetry && \
python -m poetry config virtualenvs.in-project true && \
python -m poetry install --no-root && \
/app/.venv/bin/python3 -m pip install --no-cache-dir psycopg2
USER root
RUN python -m pip uninstall poetry && \
apt-get purge -y build-essential python3-dev libpq-dev libffi-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/cache/*
USER app
# Copy the application code
COPY . /app/
COPY ./metropolis/docker_settings.py /app/metropolis/local_settings.py
USER root
EXPOSE 28780
ENTRYPOINT /app/docker_entrypoint.sh