Add build and deploy workflow
All checks were successful
Build and Deploy / build-deploy (push) Successful in 1m7s

This commit is contained in:
2026-02-25 18:43:26 +00:00
parent e38de19b22
commit b98df2f17c
7 changed files with 1539 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
name: Build and Deploy
on:
push:
branches: [master]
jobs:
build-deploy:
runs-on: ubuntu-latest
container:
image: docker:latest
volumes:
- /opt/coins:/deploy
steps:
- name: Install dependencies
run: apk add --no-cache git nodejs
- uses: actions/checkout@v4
- name: Copy source to deploy directory
run: |
rm -rf /deploy/build
cp -r . /deploy/build
- name: Create .env file
working-directory: /deploy/build
run: |
echo "HOST_PORT=${{ vars.HOST_PORT }}" > .env
echo "PHOTOS_DIR=/opt/coins/photos" >> .env
- name: Build and deploy
working-directory: /deploy/build
run: |
docker compose build
docker compose up -d
- name: Cleanup
run: rm -rf /deploy/build

28
Dockerfile Normal file
View File

@@ -0,0 +1,28 @@
FROM oven/bun:latest AS base
WORKDIR /app
RUN apt-get update && apt-get install -y imagemagick && rm -rf /var/lib/apt/lists/*
FROM base AS deps
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
FROM deps AS builder
COPY . .
RUN bunx prisma generate
RUN --mount=type=bind,from=photos,source=.,target=/app/public/photos \
bun run build
FROM base AS runner
ENV NODE_ENV=production
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
EXPOSE 3000
CMD ["bun", "run", "server.js"]

1459
bun.lock Normal file

File diff suppressed because it is too large Load Diff

BIN
bun.lockb

Binary file not shown.

13
docker-compose.yml Normal file
View File

@@ -0,0 +1,13 @@
name: coins
services:
app:
build:
context: .
additional_contexts:
- photos=/deploy/photos
ports:
- '${HOST_PORT:-3000}:3000'
volumes:
- ${PHOTOS_DIR:-./public/photos}:/app/public/photos
restart: unless-stopped

View File

@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
reactStrictMode: true,
redirects: () => [
{

View File

@@ -19,7 +19,6 @@
"@react-three/fiber": "^8.13.0",
"@tanstack/react-query": "^4.35.3",
"@tanstack/react-query-devtools": "^4.35.3",
"better-sqlite3": "^8.6.0",
"next": "^13.5.1",
"prettier": "^3.0.3",
"primeicons": "^6.0.1",