Skip to content

Commit c343e51

Browse files
committed
feat: optimize Dockerfile build process and update Go version
- Remove git clone step and switch to COPY for web directory - Add explicit directory creation for build output - Update Go version from 1.25 to 1.24 - Remove unnecessary git installation - Fix missing newline at end of file
1 parent 835b8ed commit c343e51

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33
# UI builder stage
44
FROM node:20-alpine AS ui-builder
55

6-
# Install git for cloning
7-
RUN apk add --no-cache git
8-
96
# Set working directory
107
WORKDIR /app
118

12-
# Clone the repository
13-
RUN git clone https://github.com/fdddf/opentrans.git . && \
14-
cd web && npm install && npm run build
9+
# Copy web directory for building
10+
COPY web/ ./web/
11+
12+
# Create backend/webui/dist directory for build output
13+
RUN mkdir -p backend/webui/dist
14+
15+
# Install dependencies and build
16+
# Vite config outputs to ../backend/webui/dist
17+
RUN cd web && npm install && npm run build
1518

1619
# Builder stage
17-
FROM golang:1.25-alpine AS builder
20+
FROM golang:1.24-alpine AS builder
1821

1922
RUN apk update && apk add --no-cache make gcc musl-dev git
2023

@@ -89,4 +92,4 @@ ENTRYPOINT ["opentrans"]
8992
CMD ["serve"]
9093

9194
# Expose default port
92-
EXPOSE 8080
95+
EXPOSE 8080

0 commit comments

Comments
 (0)