initial template for static sites
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
.gitea/workflows/build.yml
|
||||
static/index.html
|
||||
@@ -0,0 +1,31 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.timothykim.net -u ${{ gitea.actor }} --password-stdin
|
||||
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.timothykim.net/timothykim/${REPO_NAME}:latest
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh -o StrictHostKeyChecking=accept-new -i ~/.ssh/deploy_key deploy@${{ secrets.DEPLOY_HOST }} deploy-${REPO_NAME}
|
||||
@@ -0,0 +1 @@
|
||||
*.swp
|
||||
+12
@@ -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
|
||||
+16
@@ -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/ /index.html;
|
||||
}
|
||||
|
||||
# Cache static assets aggressively
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>${REPO_NAME}</title></head>
|
||||
<body>
|
||||
<h1>${REPO_NAME}</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user