-
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
1 parent
09af951
commit 0f05208
Showing
1 changed file
with
7 additions
and
12 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,22 +1,17 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM golang:1.22-alpine as builder | ||
|
||
FROM golang:1.22.2 | ||
|
||
WORKDIR /app | ||
RUN apk add --no-cache git | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
COPY . ./ | ||
RUN go install github.com/a-h/templ/cmd/templ@latest | ||
RUN templ generate | ||
RUN go get ./... | ||
RUN go mod tidy | ||
RUN go mod download | ||
|
||
# Build the Go binary (optimized for production) | ||
RUN mkdir -p /app/bin | ||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/bin/sac | ||
|
||
FROM scratch | ||
COPY --from=builder /app/bin/sac /sac | ||
RUN CGO_ENABLED=0 GOOS=linux go build -v -o ./sac | ||
|
||
EXPOSE 8080 | ||
ENTRYPOINT [ "./sac" ] | ||
|
||
CMD ["/sac"] |