-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (21 loc) · 814 Bytes
/
Dockerfile
File metadata and controls
37 lines (21 loc) · 814 Bytes
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
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM python:3-alpine as test
WORKDIR /home/user/app
ENV PATH=$PATH:/home/user/.local/bin
RUN apk add --no-cache build-base linux-headers
RUN pip install --no-cache uv taskipy
COPY ./ ./
RUN pip install '.[dev]'
ARG TESTBUILD=True
ENV TESTBUILD=$TESTBUILD
RUN if [ "$TESTBUILD" = 'True' ]; then task lint; fi
RUN if [ "$TESTBUILD" = 'True' ]; then task test; fi
RUN uv build --wheel --out-dir dist
CMD ["task", "test"]
FROM --platform=$BUILDPLATFORM python:3-alpine as prod
RUN addgroup --system user && adduser --system user --ingroup user
USER user
WORKDIR /home/user/app
COPY --chown=user:user --from=test /home/user/app/dist dist
RUN pip install --no-cache dist/*.whl
CMD ["python", "-m", "python_package_template.python_module_template"]