Skip to content

Commit

Permalink
update requirements path
Browse files Browse the repository at this point in the history
  • Loading branch information
mleist committed Feb 12, 2024
1 parent 4c24e44 commit 32a4dae
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions {{cookiecutter.project_slug}}/compose/production/spot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11-slim-bookworm
ARG PYTHON_VERSION=3.11.4-slim-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
Expand All @@ -12,11 +12,11 @@ ARG BUILD_ENVIRONMENT=production
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
# psycopg dependencies
# psycopg2 dependencies
libpq-dev

# Requirements are installed here to ensure they will be cached.
COPY ./requirements .
COPY ./spot/requirements .

# Create Python Dependency and Sub-Dependency Wheels.
RUN pip wheel --wheel-dir /usr/src/app/wheels \
Expand All @@ -35,13 +35,9 @@ ENV BUILD_ENV ${BUILD_ENVIRONMENT}

WORKDIR ${APP_HOME}

RUN addgroup --system django \
&& adduser --system --ingroup django django


# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg dependencies
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
gettext \
Expand All @@ -55,24 +51,20 @@ COPY --from=python-build-stage /usr/src/app/wheels /wheels/

# use wheels to install python dependencies
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
&& rm -rf /wheels/
&& rm -rf /wheels/


COPY --chown=django:django ./compose/production/spot/entrypoint /entrypoint
COPY ./compose/production/spot/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint


COPY --chown=django:django ./compose/production/spot/start /start
COPY ./compose/production/spot/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start

# copy application code to WORKDIR
COPY --chown=django:django . ${APP_HOME}
COPY ./spot/* ${APP_HOME}/

# make django owner of the WORKDIR directory as well.
RUN chown django:django ${APP_HOME}
RUN mkdir ${APP_HOME}/staticfiles

USER django

ENTRYPOINT ["/entrypoint"]

0 comments on commit 32a4dae

Please sign in to comment.