basic frontend (#3)
All checks were successful
continuous-integration/drone/push Build is passing

Co-authored-by: aovantsev <aovantsev@avito.ru>
Reviewed-on: #3
This commit is contained in:
2025-10-03 16:25:14 +00:00
parent 78122bc996
commit ebf4bdeede
52 changed files with 21272 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.21-alpine AS builder
# Build stage for Go backend
FROM golang:1.21-alpine AS go-builder
WORKDIR /app
@@ -9,12 +9,30 @@ COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Copy source code and environment files
COPY *.go ./
COPY .env* ./
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
# Build stage for React frontend
FROM node:18-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy package files
COPY frontend/package*.json ./
# Install dependencies (including dev dependencies for build)
RUN npm ci
# Copy source code
COPY frontend/ ./
# Build the React app
RUN npm run build
# Final stage
FROM alpine:latest
@@ -23,8 +41,14 @@ RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy the binary from builder stage
COPY --from=builder /app/main .
# Copy the Go binary from go-builder stage
COPY --from=go-builder /app/main .
# Copy environment files from go-builder stage
COPY --from=go-builder /app/.env* ./
# Copy the React build from frontend-builder stage
COPY --from=frontend-builder /app/frontend/build ./frontend/build
# Expose port
EXPOSE 8080