-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (47 loc) · 1.58 KB
/
Dockerfile
File metadata and controls
67 lines (47 loc) · 1.58 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Stage 1: Go Builder (Backend)
FROM golang:1.25.10-alpine AS go-builder
# Install git, as it might be needed by go mod download or go build
RUN apk add --no-cache git
WORKDIR /app
# Copy go.mod and go.sum for the entire server project
COPY server/go.mod server/go.sum ./
RUN go mod download
# Copy the entire server source code
COPY server/ ./server/
# Build backend (assuming main package is at the root of 'server/' content)
# Using -ldflags to create smaller binaries
RUN cd server && go build -ldflags="-w -s" -o /app/olake-server .
# Stage 2: Frontend Builder
FROM node:20-alpine AS node-builder
# Reuse build-time arguments during UI build if needed
WORKDIR /app/ui
# Install pnpm globally
RUN npm install -g pnpm
# Copy package files
COPY ui/package.json ui/pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install
# Copy the rest of the UI code
COPY ui/ ./
# Build the UI
RUN pnpm build
# Stage 3: Final Runtime Image
FROM alpine:3.18
# Accept build argument for version
ARG APP_VERSION=unknown
# Make version available at runtime
ENV APP_VERSION=${APP_VERSION}
# Install docker-cli
RUN apk update && apk add --no-cache docker-cli
# Set working directory
WORKDIR /app/olake-ui
# Create directories for applications
RUN mkdir -p conf config /opt/frontend/dist
# Copy built artifacts from builder stages
COPY --from=go-builder /app/olake-server ./olake-server
COPY server/conf/app.yaml ./config/app.yaml
COPY --from=node-builder /app/ui/dist /opt/frontend/dist
# Expose the Go backend port (which serves both API and frontend)
EXPOSE 8000
# Run the olake-ui app
CMD ["./olake-server"]