You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
656 B
Docker

FROM golang:1.20-alpine AS build_base
#RUN apk add --no-cache git
# Set the Current Working Directory inside the container
WORKDIR /tmp/locsi/jobs
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# Unit tests
RUN CGO_ENABLED=0 go test -v
# Build the Go app
RUN go build -o ./out/jobs .
# Start fresh from a smaller image
FROM alpine:3.9
#RUN apk add ca-certificates
COPY --from=build_base /tmp/locsi/jobs/out/jobs /app/jobs
# This container exposes port 8080 to the outside world
#EXPOSE 8080
# Run the binary program produced by `go install`
CMD ["/app/jobs"]