Files
nadir-webui/Dockerfile
T
2026-08-24 21:17:56 +02:00

54 lines
2.0 KiB
Docker

FROM oven/bun:slim AS base
WORKDIR /app
FROM base AS install
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# Runtime deps only: build/ already inlines svelte, kit, drizzle-orm & co, so the
# devDependencies were ~640MB of dead weight per arch. drizzle-kit and its libsql
# driver are the exception — `db:migrate` runs them at startup.
FROM base AS runtime-deps
COPY package.json bun.lock ./
RUN bun install --production --frozen-lockfile \
&& bun add --no-save drizzle-kit@1.0.0-beta.22 @libsql/client@0.17.3
FROM base AS build
ENV NODE_ENV=production
COPY --from=install /app/node_modules node_modules
COPY . .
RUN bun run build
FROM base AS release
ARG VERSION=dev
ARG REVISION=unknown
ARG CREATED
LABEL org.opencontainers.image.title="nadir" \
org.opencontainers.image.description="SvelteKit dashboard for nadir-agent — central web console for Nadir backend nodes." \
org.opencontainers.image.documentation="https://nadir.urania.dev/docs" \
org.opencontainers.image.url="https://tea.urania.dev/urania/nadir-webui" \
org.opencontainers.image.source="https://tea.urania.dev/urania/nadir-webui" \
org.opencontainers.image.authors="Mirko Isaia <m.isaia@urania.dev>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${REVISION}" \
org.opencontainers.image.created="${CREATED}"
ENV NODE_ENV=production \
DATABASE_URL=/app/data/db.sqlite \
HOST=0.0.0.0 \
PORT=3000 \
ORIGIN=http://localhost:3000 \
REPOSITORY_URL=https://tea.urania.dev/api/v1/repos/urania/nadir-agent/releases/latest
WORKDIR /app
COPY --from=runtime-deps /app/node_modules node_modules
COPY --from=build /app/build build
COPY --from=build /app/config config
COPY drizzle drizzle
COPY drizzle.config.ts package.json ./
RUN mkdir -p /app/data
RUN bun run db:migrate
VOLUME /app/data
EXPOSE 3000
# apply migrations (creates db.sqlite if absent), then start the server
CMD ["sh", "-c", "bun run db:migrate && bun /app/build/index.js"]