owl-blogs/Dockerfile

35 lines
505 B
Docker
Raw Permalink Normal View History

2023-07-19 17:57:22 +00:00
##
## Build Container
##
2024-01-17 20:38:41 +00:00
FROM golang:1.21-alpine as build
2023-07-19 17:57:22 +00:00
2023-07-20 17:49:52 +00:00
RUN apk add --no-cache --update git gcc g++
2023-07-19 17:57:22 +00:00
WORKDIR /tmp/owl
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
2023-07-20 17:49:52 +00:00
RUN CGO_ENABLED=1 GOOS=linux go build -o ./out/owl ./cmd/owl
2023-07-19 17:57:22 +00:00
##
## Run Container
##
FROM alpine
RUN apk add ca-certificates
COPY --from=build /tmp/owl/out/ /bin/
# This container exposes port 8080 to the outside world
2023-07-20 17:49:52 +00:00
EXPOSE 3000
WORKDIR /owl
2023-07-19 17:57:22 +00:00
# Run the binary program produced by `go install`
ENTRYPOINT ["/bin/owl"]