-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (42 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
59 lines (42 loc) · 1.41 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
# Build frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy frontend package files and install dependencies
COPY frontend/package*.json ./
RUN npm ci
# Copy the rest of the frontend code
COPY frontend/ ./
# Build the frontend
RUN npm run build
# Build backend
FROM golang:1.24-alpine AS backend-builder
WORKDIR /app/backend
# Install necessary build tools
RUN apk add --no-cache git
# Copy go mod files first for better caching
COPY backend/go.mod backend/go.sum ./
RUN go mod download
# Copy the rest of the backend code
COPY backend/ ./
# Build the backend explicitly for linux/amd64
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o teamspace-app ./cmd/server
# Final stage
FROM alpine:3.19
WORKDIR /app
# Install CA certificates for HTTPS requests
RUN apk add --no-cache ca-certificates tzdata
# Copy the backend binary from the builder stage
COPY --from=backend-builder /app/backend/teamspace-app /app/teamspace-app
# Create frontend directory structure
RUN mkdir -p /app/frontend/dist
# Copy the frontend build from the frontend builder
COPY --from=frontend-builder /app/frontend/dist/ /app/frontend/dist/
# Create directory for config
RUN mkdir -p /app/config
# Set executable permissions explicitly
RUN chmod +x /app/teamspace-app
# Expose the port the app runs on
EXPOSE 8080
# Command to run the application
ENTRYPOINT ["/app/teamspace-app"]
CMD ["--config", "/app/config/config.json"]