mirror of
https://github.com/R0m1k3/FlowReader.git
synced 2026-10-14 10:49:47 +02:00
fix(backend): solve 500 errors with auto-migrations and standardized filenames
This commit is contained in:
1 parent
8ed1782de6
commit
502b76c5d6
6 files changed
+83
-36
No files matched your search
+19
-20
@@ -1,34 +1,33 @@
|
||||
# Build stage
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Multi-stage Dockerfile for FlowReader
|
||||
|
||||
# Step 1: Build the React Frontend
|
||||
FROM node:20-alpine AS web-builder
|
||||
WORKDIR /app/web
|
||||
COPY web/package*.json ./
|
||||
RUN npm install
|
||||
COPY web/ ./
|
||||
RUN npm run build
|
||||
|
||||
# Step 2: Build the Go Backend
|
||||
FROM golang:1.24-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum* ./
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
# Copy the built frontend from Step 1
|
||||
COPY --from=web-builder /app/web/dist ./web/dist
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /server ./cmd/server
|
||||
|
||||
# Final stage
|
||||
# Step 3: Final Production Image
|
||||
FROM alpine:3.19
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install wget for healthcheck
|
||||
RUN apk add --no-cache wget ca-certificates
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /server /app/server
|
||||
# Copy the static files for the Go server to serve
|
||||
COPY --from=builder /app/web/dist /app/web/dist
|
||||
# Copy migration files for auto-migration
|
||||
COPY --from=builder /app/migrations /app/migrations
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8080
|
||||
|
||||
# Run the application
|
||||
CMD ["/app/server"]
|
||||
Reference in new issue
Block a user