-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
64 lines (53 loc) · 1.83 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
### Builder ###
FROM golang:1.19.2-alpine3.16 as builder
WORKDIR /go/src/app
ENV GIN_MODE=release
ENV GOPATH=/go
RUN apk add --no-cache \
build-base \
git \
curl \
make \
bash
COPY src/ /go/src/app
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
cd /go/src/app && \
go build -mod=readonly -ldflags="-s -w" -o goapp
### Binary ###
FROM golang:1.19.2-alpine3.16
ARG BUILD_DATE
ARG BUILD_VERSION
ARG GIT_COMMIT
ARG GIT_URL
ENV VENDOR="DevOpsCornerId"
ENV AUTHOR="DevOpsCorner.id <support@devopscorner.id>"
ENV IMG_NAME="alpine"
ENV IMG_VERSION="3.16"
ENV IMG_DESC="Docker GO App Alpine 3.16"
ENV IMG_ARCH="amd64/x86_64"
ENV ALPINE_VERSION="3.16"
LABEL maintainer="$AUTHOR" \
architecture="$IMG_ARCH" \
ubuntu-version="$ALPINE_VERSION" \
org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.name="$IMG_NAME" \
org.label-schema.description="$IMG_DESC" \
org.label-schema.vcs-ref="$GIT_COMMIT" \
org.label-schema.vcs-url="$GIT_URL" \
org.label-schema.vendor="$VENDOR" \
org.label-schema.version="$BUILD_VERSION" \
org.label-schema.schema-version="$IMG_VERSION" \
org.opencontainers.image.authors="$AUTHOR" \
org.opencontainers.image.description="$IMG_DESC" \
org.opencontainers.image.vendor="$VENDOR" \
org.opencontainers.image.version="$IMG_VERSION" \
org.opencontainers.image.revision="$GIT_COMMIT" \
org.opencontainers.image.created="$BUILD_DATE" \
fr.hbis.docker.base.build-date="$BUILD_DATE" \
fr.hbis.docker.base.name="$IMG_NAME" \
fr.hbis.docker.base.vendor="$VENDOR" \
fr.hbis.docker.base.version="$BUILD_VERSION"
ENV GIN_MODE=release
COPY --from=builder /go/src/app/goapp /usr/local/bin/goapp
ENTRYPOINT ["/usr/local/bin/goapp"]
EXPOSE 8080