Skip to content

Commit 3a3cf87

Browse files
committed
gitea
1 parent d47522c commit 3a3cf87

File tree

13 files changed

+1094
-818
lines changed

13 files changed

+1094
-818
lines changed

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules
2+
npm-debug.log
3+
.git
4+
.gitignore
5+
README.md
6+
.env
7+
.env.local
8+
.env.development.local
9+
.env.test.local
10+
.env.production.local
11+
.next
12+
out
13+
.DS_Store
14+
*.log

.gitea/workflows/demo.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Gitea Actions Demo
2+
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
3+
on: [push]
4+
5+
jobs:
6+
Explore-Gitea-Actions:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
10+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
11+
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
12+
- name: Check out repository code
13+
uses: actions/checkout@v4
14+
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
15+
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
16+
- name: List files in the repository
17+
run: |
18+
ls ${{ gitea.workspace }}
19+
- run: echo "🍏 This job's status is ${{ job.status }}."

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Multi-stage build for Next.js static export with nginx
2+
FROM node:18-alpine AS builder
3+
4+
# Set working directory
5+
WORKDIR /app
6+
7+
# Copy package files
8+
COPY package*.json ./
9+
10+
# Install all dependencies (including dev dependencies for build)
11+
RUN npm ci
12+
13+
# Copy source code
14+
COPY . .
15+
16+
# Build the app for static export
17+
RUN npm run build
18+
19+
# Production stage with nginx
20+
FROM nginx:alpine
21+
22+
# Copy built static files from builder stage
23+
COPY --from=builder /app/out /usr/share/nginx/html
24+
25+
# Copy custom nginx configuration (optional)
26+
COPY nginx.conf /etc/nginx/nginx.conf
27+
28+
# Expose port 80
29+
EXPOSE 80
30+
31+
# Start nginx
32+
CMD ["nginx", "-g", "daemon off;"]

docker-compose.portainer.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
website:
3+
image: registery.toadonload.ru/garden:latest
4+
ports:
5+
- "8080:80"
6+
container_name: cl1ckname-website-prod
7+
restart: unless-stopped
8+
healthcheck:
9+
test: ["CMD", "curl", "-f", "http://localhost/health"]
10+
interval: 30s
11+
timeout: 10s
12+
retries: 3
13+
start_period: 40s
14+
networks:
15+
- website-network
16+
17+
networks:
18+
website-network:
19+
driver: bridge

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.8'
2+
3+
services:
4+
website:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
ports:
9+
- "8081:80"
10+
container_name: cl1ckname-website
11+
restart: unless-stopped
12+
healthcheck:
13+
test: ["CMD", "curl", "-f", "http://localhost/health"]
14+
interval: 30s
15+
timeout: 10s
16+
retries: 3
17+
start_period: 40s

next.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3-
output: "export"
3+
output: "export",
4+
trailingSlash: true,
5+
images: {
6+
unoptimized: true
7+
},
8+
assetPrefix: "",
9+
basePath: "",
10+
swcMinify: false
411
}
512

613
module.exports = nextConfig

nginx.conf

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
include /etc/nginx/mime.types;
7+
default_type application/octet-stream;
8+
9+
# Logging
10+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
11+
'$status $body_bytes_sent "$http_referer" '
12+
'"$http_user_agent" "$http_x_forwarded_for"';
13+
14+
access_log /var/log/nginx/access.log main;
15+
error_log /var/log/nginx/error.log;
16+
17+
# Gzip compression
18+
gzip on;
19+
gzip_vary on;
20+
gzip_min_length 1024;
21+
gzip_proxied any;
22+
gzip_comp_level 6;
23+
gzip_types
24+
text/plain
25+
text/css
26+
text/xml
27+
text/javascript
28+
application/json
29+
application/javascript
30+
application/xml+rss
31+
application/atom+xml
32+
image/svg+xml;
33+
34+
# Security headers
35+
add_header X-Frame-Options "SAMEORIGIN" always;
36+
add_header X-Content-Type-Options "nosniff" always;
37+
add_header X-XSS-Protection "1; mode=block" always;
38+
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
39+
40+
server {
41+
listen 80;
42+
server_name localhost;
43+
root /usr/share/nginx/html;
44+
index index.html;
45+
46+
# Handle static assets
47+
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp|woff|woff2|ttf|eot)$ {
48+
expires 1y;
49+
add_header Cache-Control "public, immutable";
50+
try_files $uri =404;
51+
}
52+
53+
# Handle Next.js static export routes
54+
location / {
55+
try_files $uri $uri/index.html /index.html;
56+
}
57+
58+
# Specific route handling for better performance
59+
location = /physarum {
60+
try_files /physarum/index.html /index.html;
61+
}
62+
63+
location = /tree {
64+
try_files /tree/index.html /index.html;
65+
}
66+
67+
location = /pool {
68+
try_files /pool/index.html /index.html;
69+
}
70+
71+
# Handle routes with trailing slash
72+
location ~ ^/(physarum|tree|pool)/$ {
73+
try_files $uri/index.html /index.html;
74+
}
75+
76+
# Handle 404 errors
77+
error_page 404 /404.html;
78+
location = /404.html {
79+
internal;
80+
}
81+
82+
# Health check endpoint
83+
location /health {
84+
access_log off;
85+
return 200 "healthy\n";
86+
add_header Content-Type text/plain;
87+
}
88+
}
89+
}

0 commit comments

Comments
 (0)