-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (31 loc) · 1.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM docker.io/library/almalinux:9 AS common
LABEL org.opencontainers.image.source="https://github.com/m3nowak/rowerowe_gminy"
LABEL org.opencontainers.image.description="Rowerowe Gminy"
LABEL org.opencontainers.image.licenses=Apache-2.0
RUN ["dnf", "install", "-y", "python3.12", "python3.12-pip"]
FROM common AS build
RUN ["python3.12", "-m", "pip", "install", "pdm"]
COPY . /app
WORKDIR /app
RUN ["pdm", "build"]
FROM common as venv-api
RUN ["python3.12", "-m", "venv", "/home/rgapp/venv"]
COPY --from=build /app/dist/*.whl /app/whl/
RUN /home/rgapp/venv/bin/pip install -f /app/whl rowerowe_gminy[api]
FROM common as venv-wha
RUN ["python3.12", "-m", "venv", "/home/rgapp/venv"]
COPY --from=build /app/dist/*.whl /app/whl/
RUN /home/rgapp/venv/bin/pip install -f /app/whl rowerowe_gminy[wha]
FROM common as runtime
RUN groupadd -g 1000 rgapp
RUN useradd -ms /bin/bash -u 1000 -g 1000 rgapp
USER rgapp
WORKDIR /home/rgapp/app
FROM runtime as api
COPY --chown=rgapp:rgapp --from=venv-api /home/rgapp/venv /home/rgapp/venv
ENV PATH="/home/rgapp/venv/bin:$PATH"
ENTRYPOINT [ "rg-api", "run" ]
FROM runtime as wha
COPY --chown=rgapp:rgapp --from=venv-wha /home/rgapp/venv /home/rgapp/venv
ENV PATH="/home/rgapp/venv/bin:$PATH"
ENTRYPOINT [ "rg-wha" ]