Skip to content

Commit

Permalink
update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyYe committed Feb 18, 2024
1 parent 9c14198 commit 7ef57d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ jobs:
timothyye/godns:${{steps.tag.outputs.tag}}
ghcr.io/timothyye/godns:latest
ghcr.io/timothyye/godns:${{steps.tag.outputs.tag}}
build-args: |
VERSION=v${{ steps.tag.outputs.tag }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ RUN npm run build

# Stage 2: Build the Go backend
FROM golang:alpine AS builder
ARG VERSION
WORKDIR /godns
ADD . .
# Copy the Next.js build from the previous stage
COPY --from=web-builder /web/out ./web/out
RUN go generate ./...
RUN CGO_ENABLED=0 go build -o godns cmd/godns/godns.go
RUN CGO_ENABLED=0 go build -ldflags "-X main.Version=${VERSION}" -o godns cmd/godns/godns.go

# Final stage: Copy the Go binary into a distroless image
FROM gcr.io/distroless/base
Expand Down

0 comments on commit 7ef57d7

Please sign in to comment.