-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile
36 lines (31 loc) · 1.05 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
FROM alpine:3.11 as builder
# hadolint ignore=DL3018
RUN set -eux \
&& apk add --no-cache \
bash gcc \
python3 python3-dev
WORKDIR /src
COPY . /src/
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -eux \
&& python3 -m pip install . \
&& salt-lint --version \
&& 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.11 as production
LABEL maintainer="[email protected]" \
repo="https://github.com/warpnet/salt-lint"
# hadolint ignore=DL3018
RUN set -eux \
&& apk add --no-cache bash git python3
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -eux \
&& find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf \
&& find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf \
&& addgroup -S -g 800 linter \
&& adduser -S -u 800 -S -H -D -G linter linter
COPY --from=builder /usr/lib/python3.8/site-packages/ /usr/lib/python3.8/site-packages/
COPY --from=builder /usr/bin/salt-lint /usr/bin/salt-lint
WORKDIR /data
USER linter
ENTRYPOINT ["salt-lint"]