Merge pull request #19 from HideyoshiSolutions/feat/better-docker-build
feat: adds a better dockerfile implementation
This commit is contained in:
27
.dockerignore
Normal file
27
.dockerignore
Normal 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
|
||||
37
Dockerfile
37
Dockerfile
@@ -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
2188
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
2
poetry.toml
Normal file
2
poetry.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
[virtualenvs]
|
||||
in-project = true
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user