I am dockerizing my app that runs in a custom base image with alpine:golang and goswagger installed. Currently, I'm trying to reduce the image size by implementing a multistage build. But when I run
swagger generate
it always showing error message:
lstat /root/go: no such file or directory
Can anyone tell me what is wrong with it? Ive checked in root/go
directory and it is valid no go
folder there but I can confirm the installation of go with running go build.
Here is my dockerfile
# Custom image with alpine and go:1.18.2 + goswagger installed
# Build binary stage
FROM gcrdomain/mycomp/go:1.18.2 as build
WORKDIR /app
# Install make
RUN apk add --no-cache make gcc libc-dev
COPY . .
# swagger validate + clean + generate
RUN make all
# Serve the binary stage
# Bare image with required deps to serve static binary
FROM scratch
WORKDIR /app
COPY --from=build /app/telemedicine-proxy-server /telemedicine-proxy-server
CMD ["/telemedicine-proxy-server", "--port=8080", "--host=0.0.0.0"]