hapticlink / Dockerfile
Anuj-Panthri's picture
Update Dockerfile
2a90160
# 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"]