diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..217cb0e --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,21 @@ +name: Build and Release +run-name: ${{ gitea.actor }} build 🚀 + +on: + push: + branches: + - master + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create .env file + run: | + echo "${{ secrets.ENV_FILE }}" > .env + + - name: Deploy to Container + run: | + docker compose up -d --build --remove-orphans \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..587b71a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM node:24-alpine AS base + +# Stage 1: Dependencies Installation +FROM base AS deps + +RUN apk add --no-cache libc6-compat +WORKDIR /app + +COPY package.json package-lock.json* ./ +RUN npm ci + +# Stage 2: Application Build +FROM base AS builder +WORKDIR /app + +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +COPY .env .env + +RUN npm run build + +# Stage 3: Production Runner +FROM node:24-alpine AS runner + +WORKDIR /app + +# copy env runtime +COPY --from=builder /app/.env .env +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/public ./public + +USER node + +EXPOSE 3000 + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0ab1e46 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +services: + history-client: + build: + context: . + dockerfile: Dockerfile + container_name: history-client + restart: unless-stopped + ports: + - "3013:3000" + networks: + - history-client-network + +networks: + history-client-network: + driver: bridge diff --git a/next.config.ts b/next.config.ts index e9ffa30..36300ee 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,6 +2,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { /* config options here */ + output: 'standalone' }; export default nextConfig;