Skip to content

Commit

Permalink
Dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
tbergmueller committed Mar 4, 2024
1 parent 6a3b4e0 commit c2f24f4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit c2f24f4

Please sign in to comment.