-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (36 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
51 lines (36 loc) · 1.11 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
############################################
# Build the Next.js frontend
############################################
FROM node:20-alpine AS frontend-build
WORKDIR /app
COPY frontend/package*.json ./
COPY frontend/tsconfig.json ./
RUN npm install
COPY frontend/ .
RUN npm run build
############################################
# Build the Go GraphQL server
############################################
FROM golang:1.24.0-bullseye AS server-build
WORKDIR /go/src
COPY server/go.mod server/go.sum ./
RUN go mod download
COPY server/ .
RUN go generate ./...
RUN CGO_ENABLED=0 go build -a -o graphql-server server.go
############################################
# Final image
############################################
FROM node:20-alpine AS final
WORKDIR /app
COPY --from=frontend-build /app/package*.json ./
COPY --from=frontend-build /app/.next ./.next
COPY --from=frontend-build /app/public ./public
RUN mkdir -p ./storage/deckfiles
RUN npm install --production
COPY --from=server-build /go/src/graphql-server /usr/local/bin/graphql-server
EXPOSE 8080
CMD ["sh", "-c", "\
graphql-server & \
npm start \
"]