Skip to content

Commit

Permalink
chore: Update Docker image tags for next release
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Oct 14, 2024
1 parent 90556c1 commit 5ff995f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.23 AS deps
FROM golang:1.23-bullseye AS deps

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

FROM golang:1.23 AS build
FROM golang:1.23-bullseye AS build

WORKDIR /app
COPY --from=deps /go/pkg/mod /go/pkg/mod
Expand All @@ -14,9 +14,10 @@ ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64

RUN go build -ldflags="-s -w" -o /app/bin/sentinel ./
RUN go build -o /app/bin/sentinel ./

FROM gcr.io/distroless/cc-debian11
FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
ENV GIN_MODE=release
COPY --from=build /app/bin/sentinel /app/sentinel
CMD ["/app/sentinel"]
9 changes: 5 additions & 4 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:1.23 AS deps
FROM golang:1.23-bullseye AS deps

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

FROM golang:1.23 AS build
FROM golang:1.23-bullseye AS build

WORKDIR /app
COPY --from=deps /go/pkg/mod /go/pkg/mod
Expand All @@ -14,9 +14,10 @@ ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm64

RUN go build -ldflags="-s -w" -o /app/bin/sentinel ./
RUN go build -o /app/bin/sentinel ./

FROM gcr.io/distroless/cc-debian11
FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
ENV GIN_MODE=release
COPY --from=build /app/bin/sentinel /app/sentinel
CMD ["/app/sentinel"]
19 changes: 11 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,21 @@ func main() {
token = tokenFromEnv

endpointFromEnv := os.Getenv("ENDPOINT")
if endpointFromEnv == "" {
if gin.Mode() == gin.DebugMode {
if gin.Mode() == gin.DebugMode {
if endpointFromEnv == "" {
endpoint = "http://localhost:8000"
} else {
log.Fatal("ENDPOINT environment variable is required")
}
endpoint = endpointFromEnv
} else {
// Validate that the endpoint is a valid HTTPS URL
if !strings.HasPrefix(endpointFromEnv, "https://") {
log.Fatal("ENDPOINT must be a valid HTTPS URL")
if endpointFromEnv == "" {
log.Fatal("ENDPOINT environment variable is required")
} else {
// Validate that the endpoint is a valid HTTPS URL
if !strings.HasPrefix(endpointFromEnv, "https://") {
log.Fatal("ENDPOINT must be a valid HTTPS URL")
}
endpoint = endpointFromEnv
}
endpoint = endpointFromEnv
}
pushUrl = endpoint + pushPath

Expand Down

0 comments on commit 5ff995f

Please sign in to comment.