-
-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 1.18 KB
/
Copy pathDockerfile
File metadata and controls
34 lines (24 loc) · 1.18 KB
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
FROM python:3.14.6-slim-bookworm AS builder
ARG VERSION
ENV VIRTUAL_ENV=/opt/datamodel-code-generator
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
LABEL maintainer="Koudai Aono <koxudaxi@gmail.com>"
RUN test -n "${VERSION}" \
|| { echo "The VERSION build arg is required." >&2; exit 1; } \
&& python -m venv "${VIRTUAL_ENV}" \
&& pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir "datamodel-code-generator[http]==${VERSION}"
FROM python:3.14.6-slim-bookworm
ARG VERSION
LABEL maintainer="Koudai Aono <koxudaxi@gmail.com>" \
org.opencontainers.image.description="Generate Python data models from schema definitions" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/koxudaxi/datamodel-code-generator" \
org.opencontainers.image.title="datamodel-code-generator" \
org.opencontainers.image.version="${VERSION}"
ENV VIRTUAL_ENV=/opt/datamodel-code-generator
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
RUN useradd --create-home --shell /usr/sbin/nologin appuser
COPY --from=builder --chown=appuser:appuser /opt/datamodel-code-generator /opt/datamodel-code-generator
USER appuser
ENTRYPOINT ["datamodel-codegen"]