️ Reduce the size of the backend docker image

This commit is contained in:
2023-05-28 12:40:10 +02:00
parent 581f6b7b8f
commit 7fbdd0606c
3 changed files with 21 additions and 9 deletions

View File

@@ -1,7 +1,12 @@
docker .dir-locals.el
.dockerignore
.gitignore
**/.mypy_cache
**/.ruff_cache
.venv
**/__pycache__ **/__pycache__
poetry.lock
Dockerfile
docker-compose.yml
config config
.venv docker
poetry.lock
tests
Dockerfile

View File

@@ -1,9 +1,13 @@
FROM python:3.11-slim as builder FROM python:3.11-slim as builder
WORKDIR /app WORKDIR /app
COPY . /app
RUN apt update && apt install -y proj-bin COPY ./pyproject.toml /app
RUN apt update && \
apt install -y --no-install-recommends proj-bin && \
apt clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install --upgrade poetry && \ RUN pip install --upgrade poetry && \
poetry config virtualenvs.create false && \ poetry config virtualenvs.create false && \
@@ -15,7 +19,11 @@ FROM python:3.11-slim as runtime
COPY . /app COPY . /app
COPY --from=builder /app/requirements.txt /app COPY --from=builder /app/requirements.txt /app
RUN apt update && apt install -y postgresql libpq5 RUN apt update && \
apt install -y --no-install-recommends postgresql libpq5 && \
apt clean && \
rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir -r /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt
WORKDIR /app WORKDIR /app

View File

@@ -4,7 +4,6 @@ version = "0.1.0"
description = "" description = ""
authors = ["Adrien SUEUR <me@adrien.run>"] authors = ["Adrien SUEUR <me@adrien.run>"]
readme = "README.md" readme = "README.md"
packages = [{include = "backend"}]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.11" python = "^3.11"