From 48e7acab835e055950ab29999dbe8d8183b39d3e Mon Sep 17 00:00:00 2001 From: Harry Culpan Date: Tue, 30 Jun 2026 20:33:55 -0400 Subject: [PATCH] Add CGO_ENABLED=0 to Linux cross-compile targets; add Dockerfile CGO_ENABLED=0 ensures a fully static binary that runs in Alpine without glibc. Dockerfile copies both binaries into Alpine, installs cronie for the awp-cli cron job, and mounts runtime data (players.json, static/, logs/) from the host at runtime. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 30 ++++++++++++++++++++++++++++++ Makefile | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..41b113b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# Use a minimal base image +FROM alpine:latest + +# Set environment variables (if needed) +ENV APP_NAME="areweplaying" +ENV APP_DIR="/app" + +# Create the working directory +WORKDIR $APP_DIR + +# Copy the application binaries +COPY areweplaying /app/areweplaying +COPY awp-cli /app/awp-cli + +# Ensure the binaries are executable +RUN chmod +x /app/areweplaying +RUN chmod +x /app/awp-cli + +RUN apk add --no-cache cronie + +# NOTE: static/, players.json, .env, and logs/ are no longer copied +# into the image. They're mounted at runtime via docker-compose.yml +# so they live on the host and persist/update independently of the image. + +# Expose the port your app runs on (update if necessary) +#EXPOSE 8080 +EXPOSE 3000 + +# Set the default command +CMD crond & /app/areweplaying diff --git a/Makefile b/Makefile index 9066a1e..5a4e8f3 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ build: linuxbuild: templ generate - GOOS=linux GOARCH=amd64 go build -o areweplaying.linux cmd/web/*.go - GOOS=linux GOARCH=amd64 go build -o awp-cli.linux cmd/cli/*.go + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o areweplaying.linux cmd/web/*.go + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o awp-cli.linux cmd/cli/*.go clean: rm -rf areweplaying