From 171425047668d864be0d8faaaef0bba9bed968c0 Mon Sep 17 00:00:00 2001 From: Aidan Date: Thu, 23 Jan 2025 23:41:12 -0500 Subject: [PATCH] dockerize --- .dockerignore | 7 +++++++ .gitea/workflows/docker.yaml | 30 ++++++++++++++++++++++++++++++ Dockerfile | 10 ++++++++++ docker-compose.yml | 9 +++++++++ next.config.ts | 10 ++++++---- 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/docker.yaml create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b5f9581 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +.next +.vscode +.git +.gitignore +README.md +LICENSE \ No newline at end of file diff --git a/.gitea/workflows/docker.yaml b/.gitea/workflows/docker.yaml new file mode 100644 index 0000000..8f7b2e9 --- /dev/null +++ b/.gitea/workflows/docker.yaml @@ -0,0 +1,30 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build_and_push: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Log in to Gitea Package Registry + run: echo "${{ secrets.PACKAGE_TOKEN }}" | docker login $SERVER_URL -u $USERNAME --password-stdin + env: + SERVER_URL: ${{ secrets.SERVER_URL }} + USERNAME: ${{ secrets.USERNAME }} + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} + + - name: Build Docker Image + run: docker build -t git.pontusmail.org/LibreCloud/web:latest . + + - name: Push Docker Image + run: docker push git.pontusmail.org/LibreCloud/web:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6dbacfc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM oven/bun:1 AS base +WORKDIR /app +COPY package.json ./ +COPY bun.lockb ./ +RUN bun install --frozen-lockfile +COPY . . +RUN bun run build +EXPOSE 3000 +CMD ["bun", "start"] + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ca99fc8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + librecloud-web: + image: "git.pontusmail.org/LibreCloud/web:latest" + ports: + - "3000:3000" + environment: + - NODE_ENV=production + restart: unless-stopped + diff --git a/next.config.ts b/next.config.ts index e9ffa30..7ce7491 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,9 @@ -import type { NextConfig } from "next"; +import type { NextConfig } from "next" +/** @type {NextConfig} */ const nextConfig: NextConfig = { - /* config options here */ -}; + reactStrictMode: true, + output: "standalone", +} -export default nextConfig; +export default nextConfig