my-portfolio/Dockerfile

28 lines
829 B
Docker
Raw Normal View History

2024-04-26 15:30:48 +00:00
#Dockerfile
2024-04-13 21:34:10 +00:00
2024-04-26 15:30:48 +00:00
# Use this image as the platform to build the app
FROM node:18-alpine AS external-website
# A small line inside the image to show who made it
LABEL Developers="Christian Rannes"
# The WORKDIR instruction sets the working directory for everything that will happen next
2024-04-13 21:34:10 +00:00
WORKDIR /app
2024-04-26 15:30:48 +00:00
# Copy all local files into the image
COPY . .
# Clean install all node modules
RUN npm ci
# Build SvelteKit app
2024-04-13 21:34:10 +00:00
RUN npm run build
2024-04-26 15:30:48 +00:00
# Delete source code files that were used to build the app that are no longer needed
RUN rm -rf src/ static/ emailTemplates/ docker-compose.yml
# The USER instruction sets the user name to use as the default user for the remainder of the current stage
USER node:node
# This is the command that will be run inside the image when you tell Docker to start the container
CMD ["node","build/index.js"]