-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 707 Bytes
/
Copy pathDockerfile
File metadata and controls
29 lines (22 loc) · 707 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
FROM golang:alpine AS builder
ARG VERSION
ARG COMMIT
RUN apk add git bash gcc musl-dev upx
WORKDIR /app
ENV GO111MODULE=on
ENV CGO_ENABLED=1
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN export BUILD_DATE=`date +%FT%T%z` && \
echo "$BUILD_DATE / $COMMIT / $VERSION" && \
go build -ldflags "-w -s -X 'slender/internal/version.Version=$VERSION' -X 'slender/internal/version.Commit=$COMMIT' -X 'slender/internal/version.BuildDate=$BUILD_DATE'" -o slender main.go
RUN upx -9 -o slender.minify slender && mv slender.minify slender
FROM alpine:latest
COPY --from=builder /app/slender /bin/slender
COPY assets /app/assets
COPY web /app/web
EXPOSE 8080
WORKDIR /app
ENTRYPOINT ["slender"]