cleanup file structure, dockerize app

This commit is contained in:
KS Jannette
2026-05-19 03:37:56 -04:00
parent 4042ba87f5
commit 8cfde57cab
18 changed files with 262 additions and 98 deletions

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
# syntax=docker/dockerfile:1
FROM golang:1.25-alpine AS builder
WORKDIR /src
RUN apk add --no-cache ca-certificates git
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG APP_VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w -X main.appName=go-http-server -X main.appVersion=${APP_VERSION}" \
-o /out/server \
./cmd/app
FROM alpine:3.20
RUN apk add --no-cache ca-certificates wget
WORKDIR /app
RUN addgroup -S app && adduser -S app -G app
COPY --from=builder /out/server /app/server
USER app
EXPOSE 3000
ENTRYPOINT ["/app/server"]