File size: 1,137 Bytes
f7ddd29
f267cf0
0a2145e
53d3343
 
0a2145e
 
 
 
f7ddd29
 
 
 
0a2145e
 
 
 
 
 
 
b46dc23
0a2145e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# sudo docker build --build-arg WS_SERVER_URL=ws://localhost:3000 -t hapticlink .
# docker run --name hapticlink -d -p 3000:3000 -e WS_SERVER_URL="ws://localhost:3000" hapticlink

# Automatically run by hugging face when main get update

# STAGE 1
# Build Flutter Project
FROM cirrusci/flutter:latest AS flutter-builder

# Define an ARG for the WS_SERVER_URL
ARG WS_SERVER_URL=ws://localhost:3000
ENV WS_SERVER_URL=${WS_SERVER_URL}

WORKDIR /client

# Copies flutter project
COPY ./client /client

# Building project
RUN flutter pub get
RUN flutter build web --web-renderer canvaskit --dart-define=WS_SERVER_URL=${WS_SERVER_URL} 

# STAGE 2
# Install Node Server
FROM node:20-bullseye-slim AS node-builder

WORKDIR /server

# Copy server project
COPY ./server /server

# Install node_modules and build project
RUN npm install
RUN npm run build

# STAGE 3
# Start server
FROM node:20-bullseye-slim

ENV PORT=3000
EXPOSE 3000
ENV NODE_ENV=production

WORKDIR /server

# Copies build files from client and server
COPY --from=node-builder /server /server
COPY --from=flutter-builder /client/build/web /client/build/web

CMD ["npm", "start"]