diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index f20291c..f6c832f 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -11,16 +11,26 @@ jobs: steps: - name: Setup Bun uses: oven-sh/setup-bun@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Container Registry + uses: docker/login-action@v3 + with: + registry: docker.valverde.cloud + username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} + - name: Clone repo uses: actions/checkout@v6 - name: Install dependencies run: bun install --frozen-lockfile + - name: Lint TypeScript run: bun lint:tsc - name: Lint Biome run: bun lint:biome - - name: Build - run: bun run build + - name: Test + run: bun run test - name: Publish effect-fc uses: JS-DevTools/npm-publish@v4 with: @@ -28,3 +38,25 @@ jobs: access: public token: ${{ secrets.NPM_TOKEN }} registry: https://registry.npmjs.org + + - name: Generate Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + docker.valverde.cloud/${{ gitea.repository }} + tags: | + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=sha + flavor: | + latest=true + - name: Build Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitea/workflows/test-build.yaml b/.gitea/workflows/test-build.yaml index 729eb00..ec63b12 100644 --- a/.gitea/workflows/test-build.yaml +++ b/.gitea/workflows/test-build.yaml @@ -12,16 +12,42 @@ jobs: - name: Setup Node uses: actions/setup-node@v6 with: - node-version: "24" + node-version: "22" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Clone repo uses: actions/checkout@v6 - name: Install dependencies run: bun install --frozen-lockfile + - name: Lint TypeScript run: bun lint:tsc - name: Lint Biome run: bun lint:biome - - name: Build - run: bun run build + - name: Test + run: bun run test - name: Pack run: bun pack + + - name: Generate Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: | + docker.valverde.cloud/${{ gitea.repository }} + tags: | + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=sha + flavor: | + latest=true + - name: Build Docker image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6dac0e3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM oven/bun:1.3.12-debian@sha256:1b709c9dd883fc1af38c210f7ea5222c552a8d470ea73efbd4b8fcfee798a64b AS bun + +FROM node:22.21.1-trixie-slim@sha256:98e1429d1a0b99378b4de43fa385f0746fd6276faf4feeb6104d91f6bad290f9 +COPY --from=bun /usr/local/bin/bun /usr/local/bin/bunx /usr/local/bin/ +COPY . /app +WORKDIR /app + +RUN bun install --frozen-lockfile && \ + bun run build && \ + bun clean:cache && \ + bun clean:modules && \ + bun install --production --frozen-lockfile