added Dockerfile
This commit is contained in:
41
Dockerfile
Normal file
41
Dockerfile
Normal 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"]
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user