Add Docker support with .dockerignore and Dockerfile

This commit is contained in:
Roger Gonzalez 2024-12-04 16:28:34 -03:00
parent 194ae55cbd
commit ca78223d8e
Signed by: rogs
GPG Key ID: C7ECE9C6C36EC2E6
2 changed files with 73 additions and 0 deletions

33
.dockerignore Normal file
View File

@ -0,0 +1,33 @@
# Ignore Python cache files
__pycache__/
*.pyc
*.pyo
# Ignore virtual environments
venv/
.env/
# Ignore test files and directories
tests/
*.test.*
# Ignore Docker-specific files
.dockerignore
Dockerfile*
# Ignore version control files
.git/
.gitignore
# Ignore development tools and configs
.idea/
.vscode/
*.swp
# Ignore logs and temp files
*.log
*.tmp
*.bak
# Images
*.png

40
Dockerfile Normal file
View File

@ -0,0 +1,40 @@
FROM python:3.10-alpine AS builder
WORKDIR /app
RUN apk add --no-cache \
postgresql-dev \
gcc \
musl-dev \
libffi-dev \
curl \
g++ \
make \
libxml2-dev \
libxslt-dev \
tzdata
RUN pip install --no-cache-dir poetry
RUN poetry config virtualenvs.create false
COPY pyproject.toml poetry.lock ./
RUN poetry install --only main --no-interaction --no-ansi
FROM python:3.10-alpine
WORKDIR /app
RUN apk add --no-cache \
postgresql-libs \
libffi \
libxml2 \
libxslt \
tzdata
COPY --from=builder /usr/local/lib/python3.10 /usr/local/lib/python3.10
COPY --from=builder /app /app
ENV PYTHONPATH=/usr/local/lib/python3.10/site-packages
COPY . .