Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [main,docker]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
docker-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4

# Enable QEMU for cross-building arm64 on amd64 runner
- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64,linux/arm64
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:22-slim

WORKDIR /app

RUN apt-get update && apt-get install -y python3 make g++ \
&& rm -rf /var/lib/apt/lists/*

COPY package.json yarn.lock .yarnrc.yml ./

RUN corepack enable yarn
RUN yarn install --immutable

COPY . .

ENV NODE_ENV=production
ENV VITE_TARGET=docker
RUN yarn build

EXPOSE 3000

CMD ["yarn", "start:prod"]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dev": "vite dev",
"build": "vite build && tsc --noEmit",
"start": "vite start",
"start:prod": "node .output/server/index.mjs",
"lint": "yarn lint:biome && yarn lint:tsc",
"lint:biome": "biome check .",
"lint:tsc": "tsc --noEmit",
Expand Down Expand Up @@ -66,7 +67,7 @@
"globals": "^16.0.0",
"motion": "^12.4.7",
"postcss": "^8.5.3",
"rollup": "^4.34.8",
"rollup": "^4.52.4",
"tailwindcss": "^4.0.11",
"ts-unused-exports": "^11.0.1",
"tsc": "^2.0.4",
Expand Down
12 changes: 9 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import viteReact from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import tsConfigPaths from "vite-tsconfig-paths";

const target = process.env.VITE_TARGET;

const nitroConfig: Record<string, any> = {};

if (target !== "docker") {
nitroConfig.preset = "vercel";
}

export default defineConfig({
server: {
port: 3000,
Expand All @@ -14,9 +22,7 @@ export default defineConfig({
projects: ["./tsconfig.json"],
}),
tanstackStart(),
nitroV2Plugin({
preset: "vercel",
}),
nitroV2Plugin(nitroConfig),
tailwindcss(),
viteReact(),
],
Expand Down
Loading