diff --git a/.dockerignore b/.dockerignore index 3dd473d..fb49b8f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,12 @@ data/ .git/ .gitea/ .claude/ +.worktrees/ +docs/ .env* *.md *.xml +*.tsbuildinfo +**/__tests__/ +**/*.test.ts +**/*.test.tsx diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 5e73f03..1d77518 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -14,6 +14,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Gitea Container Registry run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin @@ -21,14 +24,13 @@ jobs: id: meta run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT" - - name: Build image - run: | - docker build \ - -t "$REGISTRY/$IMAGE:latest" \ - -t "$REGISTRY/$IMAGE:${{ steps.meta.outputs.version }}" \ - . - - - name: Push image - run: | - docker push "$REGISTRY/$IMAGE:latest" - docker push "$REGISTRY/$IMAGE:${{ steps.meta.outputs.version }}" + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.IMAGE }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ steps.meta.outputs.version }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max diff --git a/Dockerfile b/Dockerfile index 47fab82..f87a998 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,20 @@ -FROM node:22-slim AS build -WORKDIR /app -COPY package.json ./ -RUN npm install -COPY . . -RUN npx vite build +# syntax=docker/dockerfile:1.7 -FROM oven/bun:1 +FROM oven/bun:1-slim AS build +WORKDIR /app +# Install deps first for layer caching — only rebuilds when the lockfile changes. +COPY package.json bun.lock ./ +RUN --mount=type=cache,target=/root/.bun/install/cache \ + bun install --frozen-lockfile +COPY . . +RUN bun run build + +FROM oven/bun:1-slim RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg && rm -rf /var/lib/apt/lists/* WORKDIR /app -COPY package.json bun.lock* ./ -RUN bun install --frozen-lockfile --production +COPY package.json bun.lock ./ +RUN --mount=type=cache,target=/root/.bun/install/cache \ + bun install --frozen-lockfile --production COPY --from=build /app/dist/ ./dist/ COPY --from=build /app/server/ ./server/ EXPOSE 3000