Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
eoefans-api/builder/api/Dockerfile
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (25 sloc)
909 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM golang:1.18-alpine3.17 as builder | |
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories | |
#RUN apk --update add --no-cache build-base | |
WORKDIR /work | |
COPY go.mod go.sum /work/ | |
ENV GO111MODULE on | |
#ENV GOPROXY=https://goproxy.cn,direct | |
ARG SENTRY_RELEASE | |
ENV SENTRY_RELEASE $IMAGE_TAG | |
ARG VERSION | |
ENV VERSION $IMAGE_TAG | |
RUN go mod download | |
COPY ./ /work | |
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOARM=6 go build -ldflags '-w -s' -o api_server vlink.dev/eoefans/cmd/api | |
FROM alpine as prod | |
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories | |
RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata | |
ENV TZ Asia/Shanghai | |
ARG SENTRY_RELEASE | |
ENV SENTRY_RELEASE $IMAGE_TAG | |
ARG VERSION | |
ENV VERSION $IMAGE_TAG | |
COPY --from=builder /work/api_server ./ | |
EXPOSE 8080 | |
CMD ["./api_server", "-f", "config/config.yml"] |