File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Multi-stage build for xcstrings-translator
2- FROM golang:1.21-alpine AS builder
2+
3+ # UI builder stage
4+ FROM node:20-alpine AS ui-builder
5+
6+ # Install git for cloning
7+ RUN apk add --no-cache git
8+
9+ # Set working directory
10+ WORKDIR /app
11+
12+ # Clone the repository
13+ RUN git clone https://github.com/fdddf/xcstrings-translator.git . && \
14+ cd web && npm install && npm run build
15+
16+ # Builder stage
17+ FROM golang:1.25-alpine AS builder
318
419# Install build dependencies
520RUN apk add --no-cache \
621 git \
722 gcc \
8- musl-dev
23+ musl-dev \
24+ nodejs \
25+ npm
926
1027# Set working directory
1128WORKDIR /app
1229
13- # Copy go mod files
14- COPY go.mod go.sum ./
15- RUN go mod download
30+ # Clone the repository
31+ RUN git clone https://github.com/fdddf/xcstrings-translator.git .
32+
33+ # Install Go dependencies
34+ RUN go mod tidy
1635
17- # Copy source code
18- COPY . .
36+ # Copy built UI assets from ui-builder stage
37+ COPY --from=ui-builder /app/webui/dist ./webui/dist
1938
20- # Build the application
21- RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o bin/xcstrings-translator .
39+ # Build the application with GUI tag using Makefile
40+ RUN make gui
2241
2342# Final stage - minimal Alpine image
2443FROM alpine:latest
@@ -34,7 +53,7 @@ RUN addgroup -g 65532 --system nonroot && \
3453 adduser -D -u 65532 -G nonroot --system nonroot
3554
3655# Copy the binary from builder stage
37- COPY --from=builder /app/bin/ xcstrings-translator /usr/local/bin/xcstrings-translator
56+ COPY --from=builder /app/xcstrings-translator /usr/local/bin/xcstrings-translator
3857
3958# Create app directory and set permissions
4059RUN mkdir -p /app && \
You can’t perform that action at this time.
0 commit comments