konulu-konum-backend/Dockerfile

30 lines
513 B
Docker
Raw Permalink Normal View History

2024-07-29 17:53:00 +00:00
FROM golang:1.22.3-alpine AS builder
2024-07-29 17:17:31 +00:00
WORKDIR /usr/src/app
RUN apk update
RUN apk add build-base vips vips-dev
2024-07-29 17:17:31 +00:00
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=1 go build -v -o konulukonum
2024-07-29 17:17:31 +00:00
RUN go test -v ./...
FROM alpine
WORKDIR /root/app
RUN apk update
RUN apk add vips
2024-07-29 17:17:31 +00:00
COPY --from=builder /usr/src/app .
RUN mkdir public
2024-07-29 17:17:31 +00:00
CMD ["./konulukonum"]