Add build and deploy workflow
All checks were successful
Build and Deploy / build-deploy (push) Successful in 1m7s
All checks were successful
Build and Deploy / build-deploy (push) Successful in 1m7s
This commit is contained in:
38
.gitea/workflows/deploy.yaml
Normal file
38
.gitea/workflows/deploy.yaml
Normal 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
28
Dockerfile
Normal 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"]
|
||||
13
docker-compose.yml
Normal file
13
docker-compose.yml
Normal 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
|
||||
@@ -1,5 +1,6 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'standalone',
|
||||
reactStrictMode: true,
|
||||
redirects: () => [
|
||||
{
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user