Skip to content

Commit 244508b

Browse files
committed
chore: Enhance Dockerfile for CA certificates installation and update Google OAuth provider for S256 challenge
1 parent 1dd9d32 commit 244508b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ go.work
2525
swagger.json
2626
docs
2727
docs.go
28-
swagger.yaml
28+
swagger.yaml
29+
.env.production

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ RUN go build -o main .
2323
# Production stage: Create a lightweight runtime image for production
2424
FROM debian:bullseye-slim AS production
2525

26+
# Install and update CA certificates
27+
RUN apt-get update && \
28+
apt-get install -y ca-certificates && \
29+
update-ca-certificates && \
30+
rm -rf /var/lib/apt/lists/*
31+
2632
# Install necessary libraries (e.g., libc6) to run the Go binary
2733
RUN apt-get update && \
2834
apt-get install -y libc6
@@ -50,6 +56,11 @@ ENTRYPOINT ["/app/main"]
5056
# Development stage: Create a lightweight runtime image for development
5157
FROM debian:bullseye-slim AS development
5258

59+
# Install and update CA certificates
60+
RUN apt-get update && \
61+
apt-get install -y ca-certificates && \
62+
update-ca-certificates
63+
5364
# Install necessary libraries (e.g., libc6) to run the Go binary
5465
RUN apt-get update && \
5566
apt-get install -y libc6

internal/auth/providers/google_provider.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ func NewGoogleProvider(clientID, clientSecret, redirectURL string) *GoogleProvid
2727
}
2828

2929
func (g *GoogleProvider) GetAuthURL() string {
30-
return g.config.AuthCodeURL("state", oauth2.AccessTypeOffline)
30+
verifier := oauth2.GenerateVerifier()
31+
return g.config.AuthCodeURL("state", oauth2.AccessTypeOffline, oauth2.S256ChallengeOption(verifier))
3132
}
3233

3334
func (g *GoogleProvider) ExchangeCode(ctx context.Context, code string) (TokenResponse, error) {

0 commit comments

Comments
 (0)