Deploy SvelteKit node servers with docker

L

Luke Hagar

Guest
When you are NOT deploying to a nice and simple platform like Vercel, you may be doing things a little more manually.

For SvelteKit that is often really easy, tooling like nixpacks allows for a pretty much seamless deployment of most any application anywhere.

I was working on a simple little test app to explore the functionality of how Coolify and SvelteKit both handles subdomains and I was getting a node version mismatch error due to a dep requiring one of a few specific node versions.

Due to this I had to go the route of deploying with Docker instead, so here is a bare minimum Dockerfile for SvelteKit should anyone need one in the future.


Code:
# ---- Build stage ----
FROM node:24-alpine AS build

WORKDIR /app

# Install dependencies (cache-friendly)
COPY package.json package-lock.json ./
RUN npm ci

# Copy source and build
COPY . .
RUN npm run build

# ---- Run stage ----
FROM node:24-alpine AS run

WORKDIR /app

# Copy the built app
COPY --from=build /app/package.json ./
COPY --from=build /app/build ./build

EXPOSE 3000

CMD ["node", "build"]

Cheers

Continue reading...
 


Join 𝕋𝕄𝕋 on Telegram
Channel PREVIEW:
Back
Top