-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (34 loc) · 1.24 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
40
41
42
43
44
45
46
47
FROM teamserverless/license-check:0.3.9 as license-check
FROM golang:1.15 as build
ARG GIT_COMMIT
ARG GIT_COMMIT_MESSAGE
ARG VERSION
COPY --from=license-check /license-check /usr/bin/
WORKDIR /go/src/github.com/nitishkumar71/gcp-cleaner
COPY pkg pkg
COPY go.sum go.sum
COPY go.mod go.mod
COPY pkg pkg
COPY main.go .
RUN license-check -path ./ --verbose=false "Nitishkumar Singh"
# RUN go test -cover
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/cleaner .
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.12 as ship
LABEL org.opencontainers.image.source https://github.com/nitishkumar71/gcp-cleaner
LABEL org.label-schema.license="MIT" \
org.label-schema.vcs-url="https://github.com/nitishkumar71/gcp-cleaner" \
org.label-schema.vcs-type="Git" \
org.label-schema.name="nitishkumar71/gcp-cleaner" \
org.label-schema.vendor="Nitishkumar Singh" \
org.label-schema.docker.schema-version="1.0"
RUN addgroup -S app \
&& adduser -S -g app app \
&& apk add --no-cache ca-certificates
WORKDIR /home/app
EXPOSE 8080
ENV PORT 8080
ENV GIN_MODE release
COPY --from=build /go/src/github.com/nitishkumar71/gcp-cleaner/bin/cleaner .
RUN chown -R app:app ./
USER app
CMD ["./cleaner"]