-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 809 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (26 loc) · 809 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
# Étape 1 : Build du frontend
FROM node:22.9.0-alpine3.20 AS frontend-builder
WORKDIR /app/paac-app
COPY paac-app/package.json ./
RUN npm install
COPY paac-app/ .
RUN npm run build
# Étape 2 : Build de l'API Go
FROM golang:1.22-alpine3.20 AS api-builder
WORKDIR /app
COPY paac-api/ .
RUN go mod tidy
RUN go build -o /go-api
# Étape 3 : Image finale avec Nginx pour servir le frontend et Go pour l'API
FROM alpine:3.20.3
# Setup du serveur Go
WORKDIR /app
COPY --from=api-builder /go-api .
# Setup Nginx pour servir le frontend
RUN apk add --no-cache nginx
COPY --from=frontend-builder /app/paac-app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
# Exposer le port 80 pour le serveur Nginx
EXPOSE 80
# Lancer les deux services
CMD ["sh", "-c", "./go-api & nginx -g 'daemon off;'"]