Skip to content

Commit

Permalink
Dockerfile.server fixes (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettladley authored Jun 11, 2024
1 parent a3ccf10 commit cb8f59f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
tests/
docs/
*.md
*.templ
17 changes: 8 additions & 9 deletions backend/Dockerfile.server
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM golang:1.22-alpine as builder

WORKDIR /app
RUN apk add --no-cache git

COPY . ./
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
RUN go get ./...
RUN go mod tidy
COPY . .

RUN go mod download
RUN go build -tags prod -o bin/sac main.go

FROM scratch
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o bin/sac main.go

FROM alpine:latest as release

COPY --from=builder /app/bin/sac /sac

EXPOSE 8080
ENTRYPOINT [ "./sac" ]

ENTRYPOINT [ "/sac" ]
2 changes: 2 additions & 0 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/GenerateNU/sac/backend/constants"
"github.com/GenerateNU/sac/backend/database"
"github.com/GenerateNU/sac/backend/database/store"

// TODO: disable for prod with build tag
_ "github.com/GenerateNU/sac/backend/docs"
"github.com/GenerateNU/sac/backend/integrations"
"github.com/GenerateNU/sac/backend/integrations/email"
Expand Down

0 comments on commit cb8f59f

Please sign in to comment.