feat: adds a better dockerfile implementation

This commit is contained in:
2025-11-08 09:45:05 -03:00
parent 08faca95af
commit 1b09805665
5 changed files with 1261 additions and 994 deletions

27
.dockerignore Normal file
View File

@@ -0,0 +1,27 @@
# Project files
README.md
# Build and CI files
.k8s/
# Git files
.github/
.githooks/
.gitignore
# Test files
tests/
# IDE files
.vscode/
.idea/
# Docker files
Dockerfile
docker-compose.yml
.dockerignore

View File

@@ -1,11 +1,38 @@
FROM python:3.12
FROM python:3.12-slim-bookworm AS base
FROM base AS dependencies
RUN apt-get update && \
apt-get install -y build-essential curl && \
rm -rf /var/lib/apt/lists/*
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VERSION=2.2.1
# System deps:
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app
RUN pip install poetry
COPY pyproject.toml poetry.toml poetry.lock ./
RUN poetry sync --without=dev --no-root --no-interaction --no-ansi
COPY ./ /app/
RUN poetry install
FROM base AS runtime
ENTRYPOINT ["poetry", "run", "python", "-m", "storage_service"]
WORKDIR /app
COPY --from=dependencies /app/.venv ./
COPY . .
ENV PYTHONUNBUFFERED=1
ENV VIRTUAL_ENV=/app/.venv
ENTRYPOINT ["python", "-m", "storage_service"]

2188
poetry.lock generated

File diff suppressed because it is too large Load Diff

2
poetry.toml Normal file
View File

@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true

View File

@@ -3,7 +3,6 @@ name = "resize-image-service"
version = "0.1.0"
description = ""
authors = ["Vitor Hideyoshi <vitor.h.n.batista@gmail.com>"]
readme = "README.md"
packages = [{include = "storage_service"}]
[tool.poetry.dependencies]