Skip to content

Instantly share code, notes, and snippets.

@SlavenIvanov
Created May 7, 2024 13:53
Show Gist options
  • Save SlavenIvanov/409562235dcd68b2682fb821d7e87337 to your computer and use it in GitHub Desktop.
Save SlavenIvanov/409562235dcd68b2682fb821d7e87337 to your computer and use it in GitHub Desktop.
SvelteKit Dockerfile
# Step 1: Build the application
FROM node:20-alpine AS builder
# Set the working directory in the container
WORKDIR /app
# Copy all the application files to the container
COPY . /app
# Run your build process
RUN npm i --force
RUN npm run build
# Step 2: Create a smaller image for running the application
FROM node:20-alpine
# Copy only the necessary files from the builder image to the final image
COPY --from=builder /app/package*.json /app/
COPY --from=builder /app/build /app/build/
# set work dir as app
WORKDIR /app
# Expose the port the application will run on
EXPOSE 3000
#Start the Node server
CMD ["node","build"]
# You can debug the contents of the dockerfile with this
# ENTRYPOINT ["tail", "-f", "/dev/null"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment