flask-server/Dockerfile

32 lines
689 B
Docker
Raw Permalink Normal View History

2024-10-13 04:58:48 -04:00
# Use an official Python runtime as the base image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Copy the project files into the container
COPY . .
RUN chmod +x docker-entrypoint.sh
# Create a volume for the posters
VOLUME /app/posters
VOLUME /app/db
# Install the project dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variables
ENV FLASK_APP=kinolist
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_DATABASE=/app/db/movielist.sqlite
ENV FLASK_IMAGE_WIDTH=200
# Initialize the database
RUN flask --app kinolist init-db
# Expose the port the app runs on
EXPOSE 8000
# Run the application
CMD ["/app/docker-entrypoint.sh"]