Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Dockerfile 506 B
FROM golang:1.16.15 as base


WORKDIR /root
COPY . ./

RUN curl -LJ -o swag.tar.gz https://github.com/swaggo/swag/releases/download/v1.7.4/swag_1.7.4_Linux_x86_64.tar.gz
RUN tar -xf swag.tar.gz             
RUN ./swag init --parseDependency --parseDepth 2

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main .

FROM alpine:latest  
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=base /root/config ./config
COPY --from=base /root/main ./

ENTRYPOINT ["./main"]