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
|
|
|
|
|
2024-08-04 12:02:06 +00:00
|
|
|
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 . .
|
2024-08-04 12:02:06 +00:00
|
|
|
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
|
2024-08-04 12:02:06 +00:00
|
|
|
|
|
|
|
RUN apk update
|
|
|
|
|
|
|
|
RUN apk add vips
|
|
|
|
|
2024-07-29 17:17:31 +00:00
|
|
|
COPY --from=builder /usr/src/app .
|
|
|
|
|
2024-08-04 12:14:58 +00:00
|
|
|
RUN mkdir public
|
|
|
|
|
2024-07-29 17:17:31 +00:00
|
|
|
CMD ["./konulukonum"]
|