This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
FROM golang:1.21 AS builder | ||
FROM golang:1.21-bullseye AS builder | ||
ARG COMPONENT=main | ||
|
||
WORKDIR /go/src/app | ||
|
||
# Install dependencies | ||
RUN apt update && apt install -y \ | ||
make \ | ||
gcc \ | ||
libwebp-dev | ||
RUN apt update && apt install -y libwebp-dev | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
# Copy source code | ||
COPY . . | ||
|
||
# Build the app | ||
RUN make build-${COMPONENT} | ||
RUN go build -o bin/application cmd/${COMPONENT}/main.go | ||
|
||
FROM alpine AS runner | ||
ARG COMPONENT=main | ||
FROM bitnami/minideb:bullseye AS runner | ||
|
||
WORKDIR /app | ||
|
||
# Install dependencies | ||
RUN apk add --no-cache ca-certificates libwebp libwebp-tools | ||
RUN apt update && apt install -y libwebp-dev ca-certificates | ||
|
||
# Copy the binary from the build stage | ||
COPY --from=builder /go/src/app/bin/${COMPONENT} /app/application | ||
COPY --from=builder /go/src/app/bin/application /app/application | ||
|
||
# Run the binary | ||
ENTRYPOINT /app/application |