-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (32 loc) · 909 Bytes
/
Copy pathDockerfile
File metadata and controls
46 lines (32 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Stage 1: Build Frontend
FROM node:20-slim AS frontend-builder
# Set working directory
WORKDIR /app/front
# Copy frontend source files
COPY front .
# Install dependencies and build
RUN npm install && npm run build
# Stage 2: Build Backend
FROM golang:1.23 AS backend-builder
# Set working directory
WORKDIR /app
# Copy backend source files
COPY . .
# Copy built frontend files
COPY --from=frontend-builder /app/public ./public
#ENV HTTP_PROXY=http://192.168.3.102:8080
#ENV HTTPS_PROXY=http://192.168.3.102:8080
# Build backend
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o tiny-nav
# Stage 3: Final Image
FROM alpine:latest
# Set environment variables
ENV LISTEN_PORT=58080
# Set working directory
WORKDIR /app
# Copy built binary and frontend files
COPY --from=backend-builder /app/tiny-nav .
# Expose port
EXPOSE 58080
# Run the application
CMD ["./tiny-nav"]