Skip to content

Commit df5b854

Browse files
committed
feat: initial commit
0 parents  commit df5b854

File tree

14 files changed

+1108
-0
lines changed

14 files changed

+1108
-0
lines changed

.env_example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
KEY = 07e983ed1676bbfa9d01f3ea7e23179c # 32 Bytes
2+
IV = 40f38a55cb4fec35 # 16 Bytes

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/renovate.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>nezuchan/renovate-config"]
4+
}

.github/workflows/compile.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: compile
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
compile:
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x]
19+
20+
steps:
21+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: npm install
27+
- run: npm run build

.github/workflows/docker.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build & Push to container registry
2+
3+
on:
4+
release:
5+
types: [created]
6+
push:
7+
branches:
8+
- "**"
9+
pull_request:
10+
branches:
11+
- "**"
12+
paths:
13+
- "Dockerfile"
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check Out Repo
20+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
21+
22+
- name: Set up Docker Buildx
23+
id: buildx
24+
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # tag=v2.0.0
25+
26+
- name: Login to GitHub Container Registry
27+
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # tag=v2.0.0
28+
if: ${{ github.event_name != 'pull_request' }}
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Extract tag name
35+
id: tags
36+
if: ${{ github.event_name == 'release' }}
37+
run: echo ::set-output name=name::${GITHUB_REF##*/}
38+
39+
- name: Extract flavor
40+
id: flavor
41+
run: if [ "${{ github.event_name }}" = "release" ]; then echo ::set-output name=name::; else echo ::set-output name=name::-dev; fi
42+
43+
- name: Generate Docker image metadata
44+
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a # tag=v4.0.1
45+
id: img_meta
46+
with:
47+
flavor: |
48+
latest=auto
49+
suffix=${{ steps.flavor.outputs.name }}
50+
images: ghcr.io/nezuchan/image-proxy
51+
tags: |
52+
${{ steps.tags.outputs.name }}
53+
latest
54+
- name: Build and push
55+
id: docker_build
56+
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94 # tag=v3.1.1
57+
with:
58+
context: ./
59+
tags: ${{ steps.img_meta.outputs.tags }}
60+
labels: ${{ steps.img_meta.outputs.labels }}
61+
push: ${{ github.event_name != 'pull_request' }}
62+
cache-from: type=gha,mode=max
63+
cache-to: type=gha,mode=max

.github/workflows/eslint.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: eslint
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- "**"
10+
11+
jobs:
12+
eslint:
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [16.x]
19+
20+
steps:
21+
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: npm install
27+
- run: npm run lint

.gitignore

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Serverless directories
108+
.serverless/
109+
110+
# FuseBox cache
111+
.fusebox/
112+
113+
# DynamoDB Local files
114+
.dynamodb/
115+
116+
# TernJS port file
117+
.tern-port
118+
119+
# Stores VSCode versions used for testing VSCode extensions
120+
.vscode-test
121+
122+
# yarn v2
123+
.yarn/cache
124+
.yarn/unplugged
125+
.yarn/build-state.yml
126+
.yarn/install-state.gz
127+
.pnp.*
128+
129+
# Lockfiles
130+
.yarn.lock
131+
.pnp.js
132+
yarn.lock
133+
package-lock.json

.swcrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"decorators": true
6+
},
7+
"target": "es2022"
8+
},
9+
"module": {
10+
"type": "es6"
11+
}
12+
}

Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM node:16-alpine3.14 as build-stage
2+
3+
LABEL name "NezukoChan Image Proxy (Docker Build)"
4+
LABEL maintainer "KagChi"
5+
6+
WORKDIR /tmp/build
7+
8+
RUN apk add --no-cache build-base git python3
9+
10+
COPY package.json .
11+
12+
RUN npm install
13+
14+
COPY . .
15+
16+
RUN npm run build
17+
18+
RUN npm prune --production
19+
20+
FROM node:16-alpine3.14
21+
22+
LABEL name "NezukoChan Image Proxy"
23+
LABEL maintainer "KagChi"
24+
25+
WORKDIR /app
26+
27+
RUN apk add --no-cache tzdata git
28+
29+
COPY --from=build-stage /tmp/build/package.json .
30+
COPY --from=build-stage /tmp/build/package-lock.json .
31+
COPY --from=build-stage /tmp/build/node_modules ./node_modules
32+
COPY --from=build-stage /tmp/build/dist ./dist
33+
34+
VOLUME [ "/app/logs" ]
35+
36+
CMD node dist/index.js

0 commit comments

Comments
 (0)