-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (24 loc) · 1009 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
25
26
27
28
29
30
31
32
33
34
35
#------------------------------------------------
# Develop
FROM golang:1.16.2-alpine AS Development
RUN apk --no-cache add upx build-base
WORKDIR /go/src/github.com/mitsu-ksgr/vhstatus
CMD ["go", "run", "cmd/main.go", "-port", "8000", \
"-log-dir-path", "/go/src/github.com/mitsu-ksgr/vhstatus/test/logs", \
"-template-dir-path", "/go/src/github.com/mitsu-ksgr/vhstatus/web"]
#------------------------------------------------
# Builder
FROM golang:1.16.2-alpine AS Builder
RUN apk --no-cache add upx
WORKDIR /go/src/github.com/mitsu-ksgr/vhstatus
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags="-w" -o vhstatus-server cmd/main.go
RUN upx vhstatus-server
#------------------------------------------------
# binary to local
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /go/src/github.com/mitsu-ksgr/vhstatus
COPY --from=builder /go/src/github.com/mitsu-ksgr/vhstatus/vhstatus-server /root/vhstatus-server
CMD ["cp", "/root/vhstatus-server", "./"]