mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-02 03:11:37 +08:00
Add docker file
This commit is contained in:
44
.github/workflows/docker.yaml
vendored
Normal file
44
.github/workflows/docker.yaml
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
name: Docker image deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- docker-compose.yml
|
||||
- README.md
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: docker
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: lifegpc
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Extract metadata for docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: lifegpc/eh_downloader_base
|
||||
- name: Switch docker drive
|
||||
run: docker buildx create --use
|
||||
- name: Build and push Docker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
DENO_DEPLOYMENT_ID=${{ github.sha }}
|
||||
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM denoland/deno:latest
|
||||
|
||||
ARG DENO_DEPLOYMENT_ID
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./components ./components
|
||||
COPY ./islands ./islands
|
||||
COPY ./page ./page
|
||||
COPY ./routes ./routes
|
||||
COPY ./server ./server
|
||||
COPY ./static/*.css ./static/
|
||||
COPY ./static/*.ts ./static/
|
||||
COPY ./static/*.ico ./static/
|
||||
COPY ./static/*.svg ./static/
|
||||
COPY ./tasks ./tasks
|
||||
COPY ./thumbnail ./thumbnail
|
||||
COPY ./translation ./translation
|
||||
COPY ./utils ./utils
|
||||
COPY ./*.ts ./
|
||||
COPY ./deno.json ./
|
||||
COPY ./import_map.json ./
|
||||
COPY ./LICENSE ./
|
||||
|
||||
RUN deno task fetch
|
||||
ENV DENO_DEPLOYMENT_ID=${DENO_DEPLOYMENT_ID}
|
||||
RUN deno task server-build
|
||||
|
||||
EXPOSE 8000
|
||||
ENTRYPOINT deno
|
||||
CMD ["task", "server"]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
|
||||
CMD curl -Lk -fsS http://localhost:8000/api/health_check || exit 1
|
||||
@@ -114,7 +114,7 @@ export class Config {
|
||||
return this._return_bool("export_zip_jpn_title") || false;
|
||||
}
|
||||
get hostname() {
|
||||
return this._return_string("hostname") || "localhost";
|
||||
return this._return_string("hostname") || "0.0.0.0";
|
||||
}
|
||||
get meili_host() {
|
||||
return this._return_string("meili_host");
|
||||
|
||||
58
fresh.gen.ts
58
fresh.gen.ts
@@ -16,20 +16,21 @@ import * as $10 from "./routes/api/filemeta/[token].ts";
|
||||
import * as $11 from "./routes/api/files/[token].ts";
|
||||
import * as $12 from "./routes/api/gallery/[gid].ts";
|
||||
import * as $13 from "./routes/api/gallery/list.ts";
|
||||
import * as $14 from "./routes/api/status.ts";
|
||||
import * as $15 from "./routes/api/tag/[id].ts";
|
||||
import * as $16 from "./routes/api/tag/rows.ts";
|
||||
import * as $17 from "./routes/api/task.ts";
|
||||
import * as $18 from "./routes/api/thumbnail/[id].ts";
|
||||
import * as $19 from "./routes/api/token.ts";
|
||||
import * as $20 from "./routes/api/user.ts";
|
||||
import * as $21 from "./routes/file/[id].ts";
|
||||
import * as $22 from "./routes/file/_middleware.ts";
|
||||
import * as $23 from "./routes/index.tsx";
|
||||
import * as $24 from "./routes/manifest.json.ts";
|
||||
import * as $25 from "./routes/thumbnail/[id].ts";
|
||||
import * as $26 from "./routes/thumbnail/_middleware.ts";
|
||||
import * as $27 from "./routes/upload.tsx";
|
||||
import * as $14 from "./routes/api/health_check.ts";
|
||||
import * as $15 from "./routes/api/status.ts";
|
||||
import * as $16 from "./routes/api/tag/[id].ts";
|
||||
import * as $17 from "./routes/api/tag/rows.ts";
|
||||
import * as $18 from "./routes/api/task.ts";
|
||||
import * as $19 from "./routes/api/thumbnail/[id].ts";
|
||||
import * as $20 from "./routes/api/token.ts";
|
||||
import * as $21 from "./routes/api/user.ts";
|
||||
import * as $22 from "./routes/file/[id].ts";
|
||||
import * as $23 from "./routes/file/_middleware.ts";
|
||||
import * as $24 from "./routes/index.tsx";
|
||||
import * as $25 from "./routes/manifest.json.ts";
|
||||
import * as $26 from "./routes/thumbnail/[id].ts";
|
||||
import * as $27 from "./routes/thumbnail/_middleware.ts";
|
||||
import * as $28 from "./routes/upload.tsx";
|
||||
import * as $$0 from "./islands/Container.tsx";
|
||||
import * as $$1 from "./islands/Settings.tsx";
|
||||
import * as $$2 from "./islands/TaskManager.tsx";
|
||||
@@ -51,20 +52,21 @@ const manifest = {
|
||||
"./routes/api/files/[token].ts": $11,
|
||||
"./routes/api/gallery/[gid].ts": $12,
|
||||
"./routes/api/gallery/list.ts": $13,
|
||||
"./routes/api/status.ts": $14,
|
||||
"./routes/api/tag/[id].ts": $15,
|
||||
"./routes/api/tag/rows.ts": $16,
|
||||
"./routes/api/task.ts": $17,
|
||||
"./routes/api/thumbnail/[id].ts": $18,
|
||||
"./routes/api/token.ts": $19,
|
||||
"./routes/api/user.ts": $20,
|
||||
"./routes/file/[id].ts": $21,
|
||||
"./routes/file/_middleware.ts": $22,
|
||||
"./routes/index.tsx": $23,
|
||||
"./routes/manifest.json.ts": $24,
|
||||
"./routes/thumbnail/[id].ts": $25,
|
||||
"./routes/thumbnail/_middleware.ts": $26,
|
||||
"./routes/upload.tsx": $27,
|
||||
"./routes/api/health_check.ts": $14,
|
||||
"./routes/api/status.ts": $15,
|
||||
"./routes/api/tag/[id].ts": $16,
|
||||
"./routes/api/tag/rows.ts": $17,
|
||||
"./routes/api/task.ts": $18,
|
||||
"./routes/api/thumbnail/[id].ts": $19,
|
||||
"./routes/api/token.ts": $20,
|
||||
"./routes/api/user.ts": $21,
|
||||
"./routes/file/[id].ts": $22,
|
||||
"./routes/file/_middleware.ts": $23,
|
||||
"./routes/index.tsx": $24,
|
||||
"./routes/manifest.json.ts": $25,
|
||||
"./routes/thumbnail/[id].ts": $26,
|
||||
"./routes/thumbnail/_middleware.ts": $27,
|
||||
"./routes/upload.tsx": $28,
|
||||
},
|
||||
islands: {
|
||||
"./islands/Container.tsx": $$0,
|
||||
|
||||
@@ -77,15 +77,23 @@ export async function handler(req: Request, ctx: MiddlewareHandlerContext) {
|
||||
}
|
||||
if (url.pathname == "/flutter" || url.pathname.startsWith("/flutter/")) {
|
||||
const m = get_task_manager();
|
||||
let flutter_base = import.meta.resolve("../static/flutter").slice(7);
|
||||
if (Deno.build.os === "windows") {
|
||||
flutter_base = flutter_base.slice(1);
|
||||
}
|
||||
if (!m.cfg.flutter_frontend) {
|
||||
return new Response("Flutter frontend is not enabled", {
|
||||
status: 404,
|
||||
});
|
||||
if (!await exists(flutter_base)) {
|
||||
return new Response("Flutter frontend is not enabled", {
|
||||
status: 404,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
flutter_base = m.cfg.flutter_frontend;
|
||||
}
|
||||
const u = new URL(req.url);
|
||||
let p = join(m.cfg.flutter_frontend, u.pathname.slice(8));
|
||||
if (!(await exists(p)) || p === m.cfg.flutter_frontend) {
|
||||
p = join(m.cfg.flutter_frontend, "/index.html");
|
||||
let p = join(flutter_base, u.pathname.slice(8));
|
||||
if (!(await exists(p)) || p === flutter_base) {
|
||||
p = join(flutter_base, "/index.html");
|
||||
}
|
||||
const opts: GetFileResponseOptions = {};
|
||||
opts.range = req.headers.get("range");
|
||||
|
||||
@@ -19,6 +19,7 @@ function handle_auth(req: Request, ctx: MiddlewareHandlerContext) {
|
||||
const check = () => {
|
||||
if (u.pathname === "/api/token" && req.method === "PUT") return true;
|
||||
if (u.pathname === "/api/status" && req.method === "GET") return true;
|
||||
if (u.pathname === "/api/health_check" && req.method === "GET") return true;
|
||||
return false;
|
||||
};
|
||||
if (!token) return check();
|
||||
|
||||
7
routes/api/health_check.ts
Normal file
7
routes/api/health_check.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
GET(_req, _ctx) {
|
||||
return new Response("OK");
|
||||
},
|
||||
};
|
||||
2
static/.gitignore
vendored
2
static/.gitignore
vendored
@@ -1,4 +1,6 @@
|
||||
bootstrap/
|
||||
flutter
|
||||
flutter/
|
||||
preact-material-components/
|
||||
sw.js
|
||||
sw.js.map
|
||||
|
||||
Reference in New Issue
Block a user