oapi-type-definitions-extra.../dockerfile

26 lines
707 B
Plaintext

FROM golang:alpine AS builder
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
GOOS=linux \
GOARCH=amd64 \
CGO_ENABLED=0
WORKDIR /build
# Add the required build libraries
# Copy and download dependency using go mod
ADD ./src/go.* /build/
RUN go mod download
# Copy sources to build container
ADD ./src /build/
# Build the application
WORKDIR /build
RUN ls -al
RUN go build -a -tags musl -o /build/app
######################################
FROM golang:alpine
LABEL AUTHOR="AUTHOR"
#RUN apk --no-cache add curl
USER nobody
COPY --from=builder --chown=nobody /build/app /custom/app
RUN go install golang.org/x/tools/cmd/goimports@latest
ENTRYPOINT [ "/custom/app" ]