All checks were successful
Deploy Website / build-and-deploy (push) Successful in 30s
DB initialization was eager at module import time, crashing the entire analytics route when /server_storage wasn't writable. Now deferred to first logVisit() call with graceful fallback. Also fix deploy workflow to chown via a bind-mounted container so permissions apply on the host. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.0 KiB
YAML
39 lines
1.0 KiB
YAML
name: Deploy Website
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build Docker Image
|
|
run: |
|
|
docker build -t my-website:latest .
|
|
|
|
- name: Stop and Remove Existing Container
|
|
run: |
|
|
docker stop website-container || true
|
|
docker rm website-container || true
|
|
|
|
- name: Prepare Host Storage
|
|
run: |
|
|
# The bind mount creates /server_storage on the host if missing.
|
|
# Run a throwaway container to fix ownership so UID 1001 (nextjs) can write.
|
|
docker run --rm -v /server_storage:/data alpine sh -c \
|
|
"chown -R 1001:1001 /data && chmod -R 755 /data"
|
|
|
|
- name: Run New Container
|
|
run: |
|
|
docker run -d \
|
|
--name website-container \
|
|
--restart unless-stopped \
|
|
-p 8080:3000 \
|
|
-v /server_storage:/server_storage \
|
|
my-website:latest |