diff --git a/.forgejo/workflows/docker-publish.yml b/.forgejo/workflows/docker-publish.yml new file mode 100644 index 0000000..dce3621 --- /dev/null +++ b/.forgejo/workflows/docker-publish.yml @@ -0,0 +1,28 @@ +name: Build and Publish Docker Image + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: docker + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to Codeberg Container Registry + uses: docker/login-action@v3 + with: + registry: codeberg.org + username: ${{ github.repository_owner }} + # Requires a generated Application Token from your Codeberg settings saved as a repository secret + password: ${{ secrets.CODEBERG_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: codeberg.org/${{ github.repository }}:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61da87a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# Compile the React application into static files +FROM node:24-alpine AS builder +WORKDIR /app +COPY package*.json ./ +RUN npm ci +COPY . . +RUN npm run build + +# Serve the static files using a lightweight web server +FROM nginx:alpine +COPY --from=builder /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..52a60e7 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + # Redirect all unknown paths to index.html to allow React Router to handle the routing + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file