FROM python:3.12-alpine3.23

LABEL maintainer="Kenneth van Ewijk (kennyboy55)"

# Add dependencies
#RUN apk add --no-cache postgresql-libs postgresql-client
RUN apk add --no-cache tini

# Install pipenv
RUN pip install pipenv

#Print all logs without buffering it.
ENV PYTHONUNBUFFERED=1 \
    DOCKER=true

#Create app dir
RUN mkdir -p /opt/rsvp
RUN mkdir -p /opt/rsvp/static
WORKDIR /opt/rsvp

# Copy Pipfile and Pipfile.lock
COPY Pipfile Pipfile.lock ./

# Install python dependencies
RUN pipenv install --deploy --system

# Copy application code
COPY . .

RUN mkdir -p /data

# The volume containing dynamic data
VOLUME /data

#This port will be used by daphne
EXPOSE 8000

# Run the application
RUN chmod +x start.sh
ENTRYPOINT ["/sbin/tini", "--", "/opt/rsvp/start.sh"]