-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (46 loc) · 1.42 KB
/
Dockerfile
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
FROM node as builder
# Create app directory
WORKDIR /app
COPY package*.json ./
RUN sed -i '/^ "electron/g' package.json
RUN sed -i '/^ "postinstall/g' package.json
RUN npm install -g pnpm openapi-typescript-codegen
RUN pnpm install
COPY . .
RUN rm -rf vite.config.ts && mv vite-web.config.ts vite.config.ts \
&& rm -rf src/backend/app/ \
&& rm -rf src/backend/index.ts && mv src/backend/index-web.ts src/backend/index.ts
RUN mkdir -p /root/.kube/ && touch /root/.kube/config
RUN <<EOF cat > /root/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tL==
server: https://kubernetes.docker.internal:6443
name: docker-desktop
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: LS0tL==
client-key-data: LS0tL==
EOF
RUN cat /root/.kube/config
RUN nohup pnpm dev & sleep 10 && openapi --input ./swagger-spec.json --output ./src/frontend/generated --useOptions --name=Play
RUN pnpm build
FROM bitnami/kubectl:latest as kubectl
FROM node as final
WORKDIR /app
RUN npm install pm2@latest -g
COPY --from=builder /app/dist /app/
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/kubectl
EXPOSE 3007
CMD [ "pm2-runtime","start", "/app/backend/index.js" ]