-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (29 loc) · 828 Bytes
/
Copy pathDockerfile
File metadata and controls
48 lines (29 loc) · 828 Bytes
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
ARG BASE_IMAGE=gcr.io/distroless/static
# build stage
FROM golang:alpine AS build
COPY go* main* .
RUN apk add --no-cache git
RUN CGO_ENABLED=0 go build -o rabbitmq-dump-queue .
# test stage
FROM build AS test
ENV GOPATH=''
ENTRYPOINT [ "go", "test" ]
# production stage
FROM ${BASE_IMAGE} AS production
ARG UID=65532
ARG GID=65532
# make latest alpine certs available
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
USER ${UID}:${GID}
# copy app binary
COPY --from=build /go/rabbitmq-dump-queue /usr/local/bin/
ENTRYPOINT [ "rabbitmq-dump-queue" ]
# volume dir to output data
VOLUME /data
WORKDIR /data
# degug stage
FROM busybox:stable-uclibc AS busybox
FROM production AS debug
COPY --from=busybox /bin/id /bin/sh /bin/busybox /bin/
# default stage: production
FROM production