feat: Implement initial Go backend and React frontend project structure for the gotail application.
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
# Stage 1: Build Frontend
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
|
||||
WORKDIR /app/frontend
|
||||
|
||||
# Copy package files
|
||||
COPY frontend/package*.json ./
|
||||
|
||||
# Install dependencies
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
# Copy source
|
||||
COPY frontend/ ./
|
||||
|
||||
# Build
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Build Backend
|
||||
FROM golang:1.24-alpine AS backend-builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Copy go mod files
|
||||
COPY backend/go.mod backend/go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy backend source
|
||||
COPY backend/ ./
|
||||
|
||||
# Copy frontend build
|
||||
COPY --from=frontend-builder /app/frontend/dist ./dist/
|
||||
|
||||
# Build binary
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s -X main.version=2.0.0" -o /web-tail-pro ./cmd/server
|
||||
|
||||
# Stage 3: Runtime
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy binary
|
||||
COPY --from=backend-builder /web-tail-pro /app/web-tail-pro
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1000 webtail && \
|
||||
adduser -D -u 1000 -G webtail webtail && \
|
||||
chown -R webtail:webtail /app
|
||||
|
||||
USER webtail
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD wget --quiet --tries=1 --spider http://localhost:8080/health || exit 1
|
||||
|
||||
ENTRYPOINT ["/app/web-tail-pro"]
|
||||
Reference in New Issue
Block a user