Skip to content

Commit

Permalink
feature: add more files
Browse files Browse the repository at this point in the history
  • Loading branch information
syfxlin committed Jun 25, 2022
1 parent 6c9d460 commit 9377f4a
Show file tree
Hide file tree
Showing 8 changed files with 425 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .depker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

tmp
39 changes: 39 additions & 0 deletions .depker/depker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference path="https://raw.githubusercontent.com/syfxlin/depker/master/src/types/index.ts" />

export const deploy = depker.docker.of(() => ({
name: "blog",
image: "syfxlin/blog",
build: {
secret: { build: ".env" },
dockerfile_contents: depker.template.nodejs_static({
version: "node16",
// prettier-ignore
inject_prepare: [`RUN apk --no-cache add git \
shadow \
gcc \
musl-dev \
autoconf \
automake \
make \
libtool \
nasm \
tiff \
jpeg \
zlib \
zlib-dev \
file \
pkgconf \
util-linux \
g++ \
make \
python3
`]
})
},
run: {
traefik: {
domain: ["blog.ixk.me"],
tls: true
}
}
}));
15 changes: 15 additions & 0 deletions .depker/nginx/redirect-old-server.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
location ~ ^\/(?<post>[^\/]+)\.html$ {
try_files $uri $uri/ @redirect_to_post;
}

location @redirect_to_post {
return 301 $scheme://$host/post/$post/;
}

location ~ ^\/(?<year>\d\d\d\d)\/\d\d {
try_files $uri $uri/ @redirect_to_archive;
}

location @redirect_to_archive {
return 301 $scheme://$host/archive/$year/;
}
122 changes: 122 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# =========================
# Node.js-Specific Ignores
# =========================

# Build directory
public/

# Gatsby cache
.cache/
src/gatsby-types.d.ts

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# Editor
.vscode
.idea

.git
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
GATSBY_GOOGLE_ANALUTICS_ID=
GATSBY_ALGOLIA_APP_ID=
GATSBY_ALGOLIA_API_KEY=
GATSBY_ALGOLIA_INDEX_NAME=
GATSBY_ARTALK_SERVER_URL=
GATSBY_ARTALK_SITE_NAME=
# private
ALGOLIA_ADMIN_API_KEY=
35 changes: 35 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Gatsby Deploy
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
container:
image: ghcr.io/syfxlin/depker:master
env:
TZ: Asia/Shanghai
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Deploy to docker
run: |
export DOCKER_HOST=${{ secrets.DOCKER_HOST }}
export DOCKER_TLS_VERIFY=1
mkdir -p ~/.docker
echo "$CA_PEM" > ~/.docker/ca.pem
echo "$CERT_PEM" > ~/.docker/cert.pem
echo "$KEY_PEM" > ~/.docker/key.pem
echo "$SECRET_ENV" > .env
depker do deploy up -f .depker/depker.ts
env:
CA_PEM: ${{ secrets.CA_PEM }}
CERT_PEM: ${{ secrets.CERT_PEM }}
KEY_PEM: ${{ secrets.KEY_PEM }}
SECRET_ENV: ${{ secrets.SECRET_ENV }}
Loading

0 comments on commit 9377f4a

Please sign in to comment.