commit 0743082290760bdcd4d9b4b6f65e2216547b7073 Author: hantim <> Date: Sat Mar 28 13:37:49 2026 -0400 Initial commit diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..2be199a --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Gitea Registry + env: + REGISTRY_TOKEN: ${{ secrets.CI_REGISTRY_TOKEN }} + run: echo "$REGISTRY_TOKEN" | docker login git.timothykim.net -u timothykim --password-stdin + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: git.timothykim.net/hantim/hcsuzuki.music:latest + + - name: Deploy + env: + DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} + DEPLOY_HOST: ${{ vars.DEPLOY_HOST }} + run: | + mkdir -p ~/.ssh + echo "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key + ssh -o StrictHostKeyChecking=accept-new -i ~/.ssh/deploy_key deploy@"$DEPLOY_HOST" deploy-hcsuzuki.music diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0e3736 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.swp +static/media/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..eedffd1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM nginx:alpine + +# Remove default content +RUN rm -rf /usr/share/nginx/html/* + +# static site +COPY static /usr/share/nginx/html + +# a custom nginx config +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 diff --git a/README.md b/README.md new file mode 100644 index 0000000..26f9711 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# ${REPO_NAME} + +Static site hosted on the hantim platform. + +## How it works + +Put your HTML, CSS, and JS in `static/`. Push to `main` and the site deploys automatically. + +### Dockerfile + +Copies `static/` into an `nginx:alpine` container and applies `nginx.conf`. The container serves on port 80 — the platform's reverse proxy handles HTTPS and domain routing. + +### nginx.conf + +Per-container HTTP config. Serves files from `static/` with clean URLs and aggressive caching for static assets. Edit this to add custom routing, headers, or rewrites. + +### Media files + +Large files (images, videos, etc.) are stored in Garage (S3-compatible object storage), not in this repo. + +Upload with the AWS CLI: + +``` +aws --endpoint-url https://s3.hantim.net s3 cp photo.jpg s3://${REPO_NAME}/photo.jpg +aws --endpoint-url https://s3.hantim.net s3 sync static/media/ s3://${REPO_NAME}/ +``` + +Media is served at `https://www.${REPO_NAME}/media/`. Reference it in your HTML: + +```html + +``` + +## Deploy flow + +Push to `main` triggers `.gitea/workflows/build.yml`: + +1. Build Docker image from this repo +2. Push to Gitea container registry +3. SSH to server and restart the container diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..170b36e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,16 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + # Clean URLs — serve index.html for directories + location / { + try_files $uri $uri/ =404; + } + + # Cache static assets aggressively + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +} diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000..ee8988c --- /dev/null +++ b/static/index.html @@ -0,0 +1,7 @@ + + +hcsuzuki.music + +

hcsuzuki.music

+ +