FROM golang:alpine AS gobuild RUN apk update && \ apk add ca-certificates gcc git make musl-dev RUN mkdir /home/build COPY . /home/build WORKDIR /home/build RUN go mod tidy && go build -o iot-web-server FROM alpine:latest ARG PUID=2000 ARG PGID=2000 # Run App RUN addgroup -g ${PGID} iotwebserver && \ adduser -H -D -u ${PUID} -G iotwebserver iotwebserver WORKDIR /home COPY --from=gobuild /home/build/iot-web-server iot-web-server # COPY --from=gobuild /home/build/front front RUN chown -R ${PUID}:${PGID} /home USER iotwebserver CMD ["/home/iot-web-server"]