forked from darklynx/request-baskets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
24 lines (22 loc) · 874 Bytes
/
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
# Builds Request Baskets service using multi-stage builds
# Version 1.3
# Stage 1. Building service
FROM golang:latest as builder
WORKDIR /go/src/rbaskets
COPY . .
RUN GIT_VERSION="$(git describe --dirty='*' || git symbolic-ref -q --short HEAD)" \
&& GIT_COMMIT="$(git rev-parse HEAD)" \
&& GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" \
&& set -x \
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo \
-ldflags="-w -s -X main.GitVersion=${GIT_VERSION} -X main.GitCommit=${GIT_COMMIT} -X main.GitCommitShort=${GIT_COMMIT_SHORT}" \
-o /go/bin/rbaskets
# Stage 2. Packaging into alpine
FROM alpine:latest
LABEL maintainer="[email protected]"
RUN apk --no-cache add ca-certificates
VOLUME /var/lib/rbaskets
COPY docker/entrypoint.sh /bin/entrypoint
COPY --from=builder /go/bin/rbaskets /bin/rbaskets
EXPOSE 55555
CMD /bin/entrypoint