-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile.backend
45 lines (30 loc) · 1 KB
/
Dockerfile.backend
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
39
40
41
42
43
44
45
FROM python:3.11-slim-bookworm as backend-builder
WORKDIR /app
RUN apt update \
&& apt install -y --no-install-recommends gdal-bin \
&& apt-get autoremove -y \
&& apt-get clean
RUN pip install pdm \
&& find / -name "*.pyc" -exec rm -f {} \; \
&& rm -rf /root/.cache/
ADD pdm.lock pyproject.toml ./
RUN pdm sync -g -p /app --no-self \
&& find / -name "*.pyc" -exec rm -f {} \; \
&& rm -rf /root/.cache/
FROM python:3.11-slim-bookworm as backend
RUN apt update \
&& apt install -y --no-install-recommends gdal-bin \
&& apt-get autoremove -y \
&& apt-get clean
COPY --from=backend-builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
COPY --from=backend-builder /usr/local/bin/ /usr/local/bin/
ARG GIT_REVISION
ENV GIT_REVISION=${GIT_REVISION:-unknown}
WORKDIR /app
ADD . .
CMD ["python3"]
FROM backend-builder as backend-tester
WORKDIR /app
RUN pdm sync -g -p /app --no-self --dev \
&& find / -name "*.pyc" -exec rm -f {} \; \
&& rm -rf /root/.cache/