From bab627aaf5c4aac95f5c247b5cfc3367bb158fa3 Mon Sep 17 00:00:00 2001 From: rogueking Date: Tue, 6 May 2025 15:38:13 -0700 Subject: [PATCH] added Dockerfile --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ data/config.yaml | 4 ++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f904f54 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +# Build stage +FROM golang:1.22-alpine AS builder + +# # Install git and build dependencies +# RUN apk add --no-cache git make build-base + +# Set working directory +WORKDIR /app + +# Copy go mod and sum files +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the source code +COPY . . + +# Build the application +RUN CGO_ENABLED=0 GOOS=linux go build -o junk2jive-server ./cmd/junk2jive + +# Release stage +FROM alpine:latest + +# Add CA certificates and timezone data +RUN apk --no-cache add ca-certificates tzdata + +WORKDIR /app + +# Copy the binary from builder +COPY --from=builder /app/junk2jive-server /app/ +# Copy configuration if needed +COPY data/config.yaml /app/data/ + +# Create a non-root user to run our application +RUN adduser -D -g '' appuser +USER appuser + +# Expose the port the app runs on +EXPOSE 8080 + +# Command to run the executable +ENTRYPOINT ["/app/junk2jive-server"] \ No newline at end of file diff --git a/data/config.yaml b/data/config.yaml index 2899991..2636603 100644 --- a/data/config.yaml +++ b/data/config.yaml @@ -1,4 +1,4 @@ cors: allowed_origins: - - "https://junk2jive.miguelmuniz.com" - - "https://api.junk2jive.miguelmuniz.com" \ No newline at end of file + - "https://junk2jive.rogueking.dev" + - "https://api.junk2jive.rogueking.dev" \ No newline at end of file