sarlink-portal-api/.build/prod/api.Dockerfile
2025-02-08 17:25:44 +05:00

39 lines
1015 B
Docker

FROM python:3.11.4-slim-buster AS builder
WORKDIR /var/www/html/
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc
RUN pip install --upgrade pip
COPY . /var/www/html/
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /var/www/html/wheels -r requirements.txt
FROM python:3.11.4-slim-buster
WORKDIR /var/www/html/
RUN mkdir /var/www/html/staticfiles -p && chmod -R 777 /var/www/html/staticfiles
RUN apt-get update && apt-get install -y --no-install-recommends netcat
COPY --from=builder /var/www/html/wheels /wheels
COPY --from=builder /var/www/html/requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache /wheels/*
COPY . /var/www/html/
# copy entrypoint.prod.sh
COPY .build/prod/entrypoint.sh /entrypoint.sh
#RUN python manage.py collectstatic
ENTRYPOINT ["/entrypoint.sh"]
VOLUME /var/www/html/staticfiles
CMD gunicorn apibase.wsgi:application --bind 0.0.0.0:5000 --workers=2