diff --git a/Dockerfile b/Dockerfile index 8d24877..4c5d2cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,25 @@ +# syntax=docker/dockerfile-upstream:master-labs + FROM python:3.12.0-alpine as build +WORKDIR /app RUN python -m venv /opt/venv ENV PATH="/opt/venv/bin:$PATH" +COPY ./resources ./ RUN --mount=type=cache,target=/var/cache/apk/ \ --mount=type=cache,target=/root/.cache/pip \ --mount=type=bind,source=requirements.txt,target=requirements.txt \ + --mount=type=bind,source=./bin/msgfmt.py,target=./msgfmt.py \ : \ && apk add gcc musl-dev linux-headers \ - && pip install -U -r requirements.txt - + && pip install -U -r requirements.txt \ + && python ./msgfmt.py ./locale/**/LC_MESSAGES/*.po \ + && : FROM python:3.12.0-alpine as base +COPY --parents --from=build /opt/venv /app/locale/**/LC_MESSAGES/*.mo / WORKDIR /app -COPY --from=build /opt/venv /opt/venv -COPY ./alembic.ini ./src ./ -COPY ./alembic ./alembic +COPY ./src ./ +COPY --parents ./alembic.ini ./alembic ./ ENV PATH="/opt/venv/bin:$PATH" ENV PYTHONUNBUFFERED=0 diff --git a/bin/po-to-mo.sh b/bin/po-to-mo.sh deleted file mode 100644 index 5cbf6d4..0000000 --- a/bin/po-to-mo.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -python3 ./bin/msgfmt.py ./resources/locale/**/LC_MESSAGES/*.po diff --git a/docker-compose.yml b/docker-compose.yml index 4e8476c..c748784 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,6 @@ services: database: condition: service_healthy volumes: - - ./resources/locale:/app/locale - ./config.toml:/app/config.toml ports: - 666:8081