Compare commits

..

2 Commits

Author SHA1 Message Date
Nicolas Froger a23642af34
docker: build binary in Docker
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
2022-08-15 23:57:10 +02:00
Nicolas Froger d252f53a6f
main: limit healthz to /healthz endpoint
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
2022-08-15 23:56:54 +02:00
3 changed files with 21 additions and 8 deletions

View File

@ -1,7 +1,4 @@
.vscode .vscode
.git .git
go.mod
go.sum
*.go
helm helm
.*ignore .*ignore

View File

@ -1,19 +1,35 @@
FROM alpine:3.11.6 FROM golang:1.18.5 as builder
ARG GOOS="linux" ARG GOOS="linux"
ARG GOARCH="amd64" ARG GOARCH="amd64"
WORKDIR /workspace
COPY go.mod go.sum /workspace/
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -a -o hugo-mx-gateway
FROM alpine:3.16.2
ARG RUNTIME_USER="mxgateway" ARG RUNTIME_USER="mxgateway"
ARG RUNTIME_USER_UID=4583 ARG RUNTIME_USER_UID=4583
RUN apk update && apk add --no-cache ca-certificates
RUN addgroup -g $RUNTIME_USER_UID $RUNTIME_USER && \ RUN addgroup -g $RUNTIME_USER_UID $RUNTIME_USER && \
adduser --disabled-password --no-create-home --gecos "" \ adduser --disabled-password --no-create-home --gecos "" \
--home /app --ingroup $RUNTIME_USER --uid $RUNTIME_USER_UID $RUNTIME_USER --home /app --ingroup $RUNTIME_USER --uid $RUNTIME_USER_UID $RUNTIME_USER
COPY entrypoint.sh bin/hugo-mx-gateway LICENSE /app/ WORKDIR /app
COPY --from=builder /workspace/hugo-mx-gateway .
COPY entrypoint.sh LICENSE /app/
COPY templates /app/templates COPY templates /app/templates
RUN chown -R $RUNTIME_USER:$RUNTIME_USER /app RUN chown -R $RUNTIME_USER:$RUNTIME_USER /app
WORKDIR /app
ENTRYPOINT ["sh", "./entrypoint.sh"] ENTRYPOINT ["sh", "./entrypoint.sh"]

View File

@ -46,7 +46,7 @@ var routes = Routes{
Route{ Route{
"Healthz", "Healthz",
"GET", "GET",
"/", "/healthz",
http.HandlerFunc(Healthz), http.HandlerFunc(Healthz),
}, },
} }