Skip to content

Commit 233d146

Browse files
committed
Migrate to Bun package manager, add CI workflows and Dockerfile
1 parent 74ec877 commit 233d146

6 files changed

Lines changed: 165 additions & 8018 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: publish on docker registery
2+
3+
# This workflow uses actions that are not certified by GitHub.
4+
# They are provided by a third-party and are governed by
5+
# separate terms of service, privacy policy, and support
6+
# documentation.
7+
on:
8+
push:
9+
branches: [ "main" ]
10+
# Publish semver tags as releases.
11+
tags: [ 'v*.*.*' ]
12+
# pull_request:
13+
# branches: [ "main" ]
14+
15+
env:
16+
# Use docker.io for Docker Hub if empty
17+
REGISTRY: ghcr.io
18+
# github.repository as <account>/<repo>
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
id-token: write
28+
29+
steps:
30+
- name: Checkout repository
31+
uses: actions/checkout@v3
32+
33+
# Install the cosign tool except on PR
34+
# https://github.com/sigstore/cosign-installer
35+
- name: Install cosign
36+
if: github.event_name != 'pull_request'
37+
uses: sigstore/cosign-installer@v4.0.0
38+
with:
39+
cosign-release: 'v3.0.2'
40+
#- name: Install cosign
41+
# if: github.event_name != 'pull_request'
42+
# uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1
43+
# with:
44+
# cosign-release: 'v2.1.1'
45+
46+
# Set up BuildKit Docker container builder to be able to build
47+
# multi-platform images and export cache
48+
# https://github.com/docker/setup-buildx-action
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
51+
52+
# Login against a Docker registry except on PR
53+
# https://github.com/docker/login-action
54+
- name: Log into registry ${{ env.REGISTRY }}
55+
if: github.event_name != 'pull_request'
56+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
57+
with:
58+
registry: ${{ env.REGISTRY }}
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
# Extract metadata (tags, labels) for Docker
63+
# https://github.com/docker/metadata-action
64+
- name: Extract Docker metadata
65+
id: meta
66+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
67+
with:
68+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
69+
70+
# Build and push Docker image with Buildx (don't push on PR)
71+
# https://github.com/docker/build-push-action
72+
- name: Build and push Docker image
73+
id: build-and-push
74+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
75+
with:
76+
context: ./app
77+
push: ${{ github.event_name != 'pull_request' }}
78+
tags: ${{ steps.meta.outputs.tags }}
79+
labels: ${{ steps.meta.outputs.labels }}
80+
81+
# Sign the resulting Docker image digest except on PRs.
82+
# This will only write to the public Rekor transparency log when the Docker
83+
# repository is public to avoid leaking data. If you would like to publish
84+
# transparency data even for private images, pass --force to cosign below.
85+
# https://github.com/sigstore/cosign
86+
# - name: Sign the published Docker image
87+
# if: ${{ github.event_name != 'pull_request' }}
88+
# env:
89+
# # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
90+
# TAGS: ${{ steps.meta.outputs.tags }}
91+
# DIGEST: ${{ steps.build-and-push.outputs.digest }}
92+
# # This step uses the identity token to provision an ephemeral certificate
93+
# # against the sigstore community Fulcio instance.
94+
# run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM oven/bun:alpine AS base
2+
3+
WORKDIR /app
4+
ADD package.json .
5+
ADD bun.lock .
6+
RUN bun i
7+
ADD . .
8+
RUN bun run build
9+
FROM oven/bun:alpine AS production
10+
WORKDIR /app
11+
COPY --from=base /app/.next/standalone ./
12+
COPY --from=base /app/.next/static .
13+
CMD [ "bun","--bun","server.js" ]

0 commit comments

Comments
 (0)