EvalueTonSavoir/quizRoom/Dockerfile

30 lines
644 B
Text
Raw Permalink Normal View History

# Use the Node base image
2024-11-10 20:42:02 -05:00
FROM node:18 AS quizroom
ARG PORT=4500
ENV PORT=${PORT}
ENV ROOM_ID=${ROOM_ID}
# Create a working directory
WORKDIR /usr/src/app
2024-11-05 16:37:07 -05:00
# Copy package.json and package-lock.json (if available) and install dependencies
COPY package*.json ./
RUN npm install
2024-11-05 16:37:07 -05:00
# Copy the rest of the source code to the container
COPY . .
2024-11-05 16:37:07 -05:00
# Build the TypeScript code
RUN npm run build
# Expose WebSocket server port
EXPOSE ${PORT}
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 \
CMD /usr/src/app/healthcheck.sh
2024-11-05 16:37:07 -05:00
# Start the server using the compiled JavaScript file
CMD ["node", "dist/app.js"]