Merge pull request #146 from KevinZhang19870314/main

feat: add Dockerfile
This commit is contained in:
Harry 2024-04-02 15:38:09 +08:00 committed by GitHub
commit 7fb1a95a82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 53 additions and 0 deletions

23
.dockerignore Normal file
View File

@ -0,0 +1,23 @@
# Exclude common Python files and directories
venv/
__pycache__/
*.pyc
*.pyo
*.pyd
*.pyz
*.pyw
*.pyi
*.egg-info/
# Exclude development and local files
.env
.env.*
*.log
*.db
# Exclude version control system files
.git/
.gitignore
.svn/
storage/

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /usr/src/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
imagemagick \
&& rm -rf /var/lib/apt/lists/*
# Fix security policy for ImageMagick
RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
# Copy the current directory contents into the container at /usr/src/app
COPY . .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the port the app runs on
EXPOSE 8080
# Command to run the application
CMD ["python", "main.py"]
# At runtime, mount the config.toml file from the host into the container
# using Docker volumes. Example usage:
# docker run -v /path/to/your/config.toml:/usr/src/app/config.toml -p 8080:8080 moneyprinterturbo