Dockerize SvelteKit

Alper Çıtak
3 min readJul 24, 2022

Build & run SvelteKit project on Docker

Svelte is a great framework to build web applications

First, we’re going to initialize our project.

npm init svelte svelte-docker

I’m going to use yarn as the package manager, npm also works.

yarn
yarn dev

If we browse http://localhost:3000 we will see that our application is ready.

We can build the application with the adapter that we need and choose.

I’ll demonstrate Static and Node adapters in this article.

Before I get to the Dockerfiles, I’ll create a .dockerignore file.

Static Adapter

Static adapter lets us build the application as a collection of static files.

I’ll add the adapter.

yarn add @sveltejs/adapter-static -D

We need to change the svelte.config.js to use the static adapter.

--

--