Docker build script
This commit is contained in:
parent
c038ad5107
commit
cb18a5f42a
3 changed files with 20 additions and 0 deletions
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
FROM golang:1.13 AS builder
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN go generate
|
||||
RUN \
|
||||
CGO_ENABLED=0 \
|
||||
GOOS=linux \
|
||||
GOPROXY=https://proxy.golang.org,direct \
|
||||
go build -o main main.go
|
||||
|
||||
FROM scratch
|
||||
COPY contrib/etc_group /etc/group
|
||||
COPY contrib/etc_passwd /etc/passwd
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=builder /app/main /main
|
||||
USER user
|
||||
ENTRYPOINT ["/main"]
|
||||
CMD ["server"]
|
1
contrib/etc_group
Normal file
1
contrib/etc_group
Normal file
|
@ -0,0 +1 @@
|
|||
nogroup:x:65534:
|
1
contrib/etc_passwd
Normal file
1
contrib/etc_passwd
Normal file
|
@ -0,0 +1 @@
|
|||
user:!x:33:33:nogroup:/var/www:/usr/sbin/nologin
|
Loading…
Reference in a new issue