diff --git a/Dockerfile b/Dockerfile index f6f2c43..7e9f850 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,13 @@ # ------------------------- # 1) Builder stage # ------------------------- -FROM golang:1.20-alpine AS builder +FROM golang:1.24-alpine AS builder -# Install CA certificates required for building -RUN apk add --no-cache ca-certificates +ENV GOTOOLCHAIN=auto WORKDIR /app - -# Copy local repository into the build image (portable across OSes) COPY . /app -# Ensure config.example exists; keep a fallback copy -RUN cp cmd/server/config.example.json cmd/server/config.json || true - -# Normalize go.mod 'go' directive to a valid major.minor form to avoid build errors -RUN if [ -f go.mod ]; then \ - sed -E -i 's/^go[[:space:]]+[0-9]+(\.[0-9]+){1,2}$/go 1.20/' go.mod || true; \ - fi - -# Build a static Linux binary for the server RUN cd cmd/server && CGO_ENABLED=0 GOOS=linux go build -o ts6viewer . # ------------------------- @@ -27,22 +15,16 @@ RUN cd cmd/server && CGO_ENABLED=0 GOOS=linux go build -o ts6viewer . # ------------------------- FROM alpine:latest -# Install CA certificates and gettext for envsubst -RUN apk add --no-cache ca-certificates gettext +RUN apk add --no-cache ca-certificates gettext openssh-client -# Set working directory to where the server expects config.json when using relative path WORKDIR /app/cmd/server -# Copy the built app and assets from builder COPY --from=builder /app /app -# Copy entrypoint script and ensure it's executable COPY entrypoint.sh /app/entrypoint.sh -RUN chmod +x /app/entrypoint.sh || true -RUN chmod +x /app/cmd/server/ts6viewer || true +RUN chmod +x /app/entrypoint.sh +RUN chmod +x /app/cmd/server/ts6viewer -# Expose the internal port the app listens on EXPOSE 8080 -# Use the entrypoint to generate config and start the app ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/README.md b/README.md index 977098a..33a4c2a 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,23 @@ -# TS6 Viewer +TS6 Viewer