40 lines
812 B
Docker
40 lines
812 B
Docker
FROM python:3.12-alpine3.23
|
|
|
|
# Add postgress dependencies
|
|
#RUN apk add --no-cache postgresql-libs postgresql-client
|
|
|
|
# Install pipenv
|
|
RUN pip install pipenv
|
|
|
|
#Print all logs without buffering it.
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
DOCKER=true
|
|
|
|
#Create app dir and install requirements.
|
|
RUN mkdir /opt/rsvp
|
|
RUN mkdir /opt/rsvp/static
|
|
WORKDIR /opt/rsvp
|
|
|
|
# Copy Pipfile and Pipfile.lock
|
|
COPY Pipfile Pipfile.lock ./
|
|
|
|
# Install dependencies
|
|
RUN pipenv install --deploy --system
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
RUN python manage.py collectstatic --no-input
|
|
RUN python -m blacknoise.compress /opt/rsvp/static/
|
|
|
|
#This port will be used by nginx.
|
|
EXPOSE 8000 8000
|
|
|
|
RUN mkdir /data
|
|
RUN mkdir /data/media
|
|
|
|
# The volume containing dynamic data
|
|
VOLUME /data
|
|
|
|
# Run the application
|
|
CMD ["daphne", "rsvpproject.asgi:application"] |