Skip to content

Instantly share code, notes, and snippets.

@aureateAnatidae
Created November 1, 2025 05:04
Show Gist options
  • Select an option

  • Save aureateAnatidae/a6bd789930eafef6355fbff942ebced8 to your computer and use it in GitHub Desktop.

Select an option

Save aureateAnatidae/a6bd789930eafef6355fbff942ebced8 to your computer and use it in GitHub Desktop.
Development Dockerfile and compose file for bun w/ SvelteKit
services:
frontend:
image: <Your image name>
build:
context: frontend
dockerfile: development.Dockerfile
develop:
watch:
- action: sync
path: ./frontend
target: /usr/src/app
initial_sync: true
ignore:
- node_modules/
- .svelte-kit/
- action: rebuild
path: ./frontend/package.json
env_file:
- path: ./frontend/.env.development
required: false
restart: always
command: "bun dev"
# From the official bun Dockerfile tutorial
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
RUN cd /temp/dev && bun add -D @rollup/rollup-linux-arm64-gnu
FROM base AS development
ENV NODE_ENV=development
COPY --chown=bun:bun --from=install /temp/dev/node_modules node_modules
COPY --chown=bun:bun . .
# For SvelteKit
RUN mkdir .svelte-kit/ && chown bun:bun .svelte-kit
# If you have permissions issues, run as root (delete line below)
USER bun
EXPOSE 5173/tcp
# Vite hot-reload port
EXPOSE 24678/tcp
CMD ["bun", "dev"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment