document deployment

This commit is contained in:
2025-07-19 00:55:13 +02:00
parent 051c291b8c
commit 178f5c517d
12 changed files with 643 additions and 71 deletions

37
Dockerfile.backend Normal file
View File

@ -0,0 +1,37 @@
# Backend API server Dockerfile
FROM golang:1.21-alpine AS builder
WORKDIR /app
# Install git
RUN apk add --no-cache git
# Clone the repository
RUN git clone https://git.raphaelforment.fr/BuboBubo/palace.git .
# Build the Go application
WORKDIR /app/server
RUN go mod tidy
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o main .
# Production stage
FROM alpine:latest
# Install sqlite3 for CGO
RUN apk --no-cache add ca-certificates sqlite
WORKDIR /root/
# Copy the binary
COPY --from=builder /app/server/main .
# Create data directory for SQLite
RUN mkdir -p /data
# Expose port
EXPOSE 3001
# Set environment variable for database location
ENV DB_PATH=/data/palace.db
CMD ["./main"]