-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile.alpine
65 lines (51 loc) · 2.15 KB
/
Dockerfile.alpine
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 2018 clair authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM golang:1.13-alpine AS build-env
LABEL maintainer "Jimmy Zelinskie <[email protected]>"
ARG GIT_TAG
RUN apk add --no-cache git bzr rpm xz supervisor gcc musl-dev
# Build cfssl and jwtproxy
RUN go get -u github.com/cloudflare/cfssl/cmd/cfssl
RUN go get -u github.com/cloudflare/cfssl/cmd/cfssljson
RUN go get -u github.com/coreos/jwtproxy/cmd/jwtproxy
# Build clair
run git clone -b $GIT_TAG https://github.com/quay/clair /go/clair/
WORKDIR /go/clair/
RUN export CLAIR_VERSION=$(git describe --always --tags --dirty) && \
go install -ldflags "-X github.com/quay/clair/v2/pkg/version.Version=$CLAIR_VERSION" -v ./cmd/clair
FROM alpine:3.11 AS runtime-env
LABEL maintainer "Jimmy Zelinskie <[email protected]>"
ENV CLAIRDIR /clair
ENV CLAIRCONF /clair/config
RUN mkdir $CLAIRDIR
WORKDIR $CLAIRDIR
RUN apk add --no-cache supervisor ca-certificates \
git bzr rpm xz
# Copy built binaries into the runtime image
COPY --from=build-env /go/bin/cfssl /usr/local/bin/cfssl
COPY --from=build-env /go/bin/cfssljson /usr/local/bin/cfssljson
COPY --from=build-env /go/bin/clair /usr/local/bin/clair
COPY --from=build-env /go/bin/jwtproxy /usr/local/bin/jwtproxy
# Add the init scripts
ADD generate_mitm_ca.sh $CLAIRDIR/generate_mitm_ca.sh
ADD clair-entrypoint.sh $CLAIRDIR/clair-entrypoint.sh
ADD supervisord.conf $CLAIRDIR/supervisord.conf
RUN chgrp -R 0 $CLAIRDIR && \
chmod -R g=u $CLAIRDIR
RUN mkdir -p /tmp && chgrp 0 /tmp && chmod g=u /tmp && \
chmod g=u /etc/passwd
VOLUME ["/clair/config", "/clair/certs"]
EXPOSE 6060 6061
ENTRYPOINT ["/clair/clair-entrypoint.sh"]
CMD ["scanner"]