diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ea5ded5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Use the official Node.js 18.16.0 image from Docker Hub +# Note 3d-web-experience is picky here and only allows exactly 18.16.0 +# Not even 18.16.1 is supported... +FROM node:18.16.0 + +# Create and set the working directory inside the container +WORKDIR /app + +# Copy project contents +COPY . . + +# Remove unneeded folders - this could be done better by not copying them in the first place +RUN rm -rf node_modules .nx .github .codesandbox + +# Install the project dependencies +RUN npm install +RUN npm run build + +# Expose the port your app runs on +EXPOSE 8080 + +# Command to run your app +CMD ["npm", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a7b00ad --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.8' +services: + app: + build: . + ports: + - "8080:8080" + volumes: + # Mount the local folder to reflect code-changes in the container + - .:/app + # Ensure node_modules is not mounted + - /app/node_modules + # Use the cache-volume + - nx-cache:/app/.nx + environment: + NODE_ENV: development + command: npm run start + +volumes: + nx-cache: