blob: f2e71d6532b445c38324f5cdebd51fea69563c71 (
plain) (
tree)
|
|
FROM docker.io/golang:alpine
RUN addgroup -S app && adduser -S -g app app
WORKDIR /app
RUN apk add --update npm
RUN npm i sass govuk-frontend --save
# Switch to root user
USER root
COPY go.mod ./
RUN go mod download && go mod verify
COPY . .
RUN chown -R app:app /app
# Create a directory for the binary
RUN mkdir /app/bin
RUN chown app:app /app/bin
# Switch back to app user
USER app
# Build the Go binary in the /app/bin directory
RUN go build -v -o /app/bin/app ./cmd/web
# Set the working directory to /app/bin
WORKDIR /app/bin
CMD ["./app"]
EXPOSE 4000
|