added Dockerfile
Some checks failed
golangci-lint / lint (push) Failing after 15s
Run Go Tests / build (push) Failing after 0s
Build and Push Docker Image / Build and push image (push) Failing after 28s

This commit is contained in:
2025-05-06 15:38:13 -07:00
parent 5ed38bc6e8
commit bab627aaf5
2 changed files with 43 additions and 2 deletions

41
Dockerfile Normal file
View File

@@ -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"]

View File

@@ -1,4 +1,4 @@
cors:
allowed_origins:
- "https://junk2jive.miguelmuniz.com"
- "https://api.junk2jive.miguelmuniz.com"
- "https://junk2jive.rogueking.dev"
- "https://api.junk2jive.rogueking.dev"