-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
39 lines (32 loc) · 1.13 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
39
FROM alpine:3.21 AS builder
RUN set -eux \
&& apk add --no-cache \
bc \
py3-pip \
python3
ARG VERSION="latest"
RUN set -eux \
&& if [ "${VERSION}" = "latest" ]; then \
apk add yamllint; \
else \
NEXT="$( echo "${VERSION}+1" | bc )"; \
apk add "yamllint>=${VERSION},<${NEXT}"; \
fi \
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf
FROM alpine:3.21 AS production
ARG VERSION="latest"
LABEL "org.opencontainers.image.licenses"="MIT"
LABEL "org.opencontainers.image.ref.name"="Yamllint ${VERSION}"
LABEL "org.opencontainers.image.title"="Yamllint ${VERSION}"
LABEL "org.opencontainers.image.description"="Yamllint ${VERSION}"
RUN set -eux \
&& apk add --no-cache python3 \
&& ln -sf /usr/bin/python3 /usr/bin/python \
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf
COPY --from=builder /usr/lib/python3.12/site-packages/ /usr/lib/python3.12/site-packages/
COPY --from=builder /usr/bin/yamllint /usr/bin/yamllint
WORKDIR /data
ENTRYPOINT ["yamllint"]
CMD ["--help"]