Skip to content

Commit

Permalink
📦 add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
iyear committed Dec 30, 2021
1 parent 98f4994 commit c58c2b6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM golang:1.17-alpine as builder

WORKDIR /app

ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct \
CGO_ENABLED=0

# cache
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download

COPY . .
RUN go build -ldflags '-w -s' -o pure-live .

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk add --no-cache ca-certificates

RUN mkdir build && cp pure-live build && cp -r static build \
&& mkdir build/config && mv config/server.yaml.example build/config/server.yaml \
&& mv config/account.yaml.example build/config/account.yaml

FROM scratch

COPY --from=builder /app/build /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

EXPOSE 8800

ENTRYPOINT ["/pure-live","run"]

0 comments on commit c58c2b6

Please sign in to comment.