Skip to content

Commit

Permalink
build translation with the image
Browse files Browse the repository at this point in the history
  • Loading branch information
AiroPi committed Dec 17, 2023
1 parent 2db7d8a commit 96301e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 0 additions & 2 deletions bin/po-to-mo.sh

This file was deleted.

1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ services:
database:
condition: service_healthy
volumes:
- ./resources/locale:/app/locale
- ./config.toml:/app/config.toml
ports:
- 666:8081
Expand Down

0 comments on commit 96301e1

Please sign in to comment.