2023-10-04 00:07:55 -03:00
|
|
|
FROM python:3.12.0-slim-bookworm
|
|
|
|
LABEL maintainer="devfzn@gmail.com"
|
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
|
|
|
|
COPY ./requirements.txt /tmp/requirements.txt
|
|
|
|
COPY ./requirements.dev.txt /tmp/requirements.dev.txt
|
|
|
|
COPY ./app /app
|
|
|
|
WORKDIR /app
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
ARG DEV=false
|
2023-10-05 22:48:42 -03:00
|
|
|
|
2023-10-04 00:07:55 -03:00
|
|
|
RUN python -m venv /py && \
|
2023-10-05 22:48:42 -03:00
|
|
|
apt update && \
|
2023-10-11 17:59:44 -03:00
|
|
|
apt install -y postgresql-client libjpeg-dev python3-dev libpq-dev \
|
|
|
|
gcc python3-psycopg2 zlib1g zlib1g-dev && \
|
2023-10-05 22:48:42 -03:00
|
|
|
apt clean && \
|
2023-10-04 00:07:55 -03:00
|
|
|
/py/bin/pip install --upgrade pip && \
|
|
|
|
/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 && \
|
|
|
|
adduser \
|
|
|
|
--disabled-password \
|
|
|
|
--no-create-home \
|
2023-10-11 17:59:44 -03:00
|
|
|
django-user && \
|
|
|
|
mkdir -p /vol/web/media && \
|
|
|
|
mkdir -p /vol/web/static && \
|
|
|
|
chown -R django-user:django-user /vol && \
|
|
|
|
chmod -R 755 /vol
|
2023-10-04 00:07:55 -03:00
|
|
|
|
|
|
|
ENV PATH="/py/bin:$PATH"
|
|
|
|
|
|
|
|
USER django-user
|