-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bd2d0db
Showing
11 changed files
with
1,574 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# deps | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
merge_group: | ||
|
||
jobs: | ||
build_graphql_api: | ||
name: Docker Image (Nicovideo Updater) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
with: | ||
submodules: true | ||
- uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 | ||
with: | ||
dockerfile: Dockerfile | ||
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3 | ||
- uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5 | ||
with: | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
context: . | ||
push: ${{ github.event_name == 'push' }} | ||
tags: ghcr.io/${{ github.repository_owner }}/nicovide-updater:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "prisma"] | ||
path = prisma | ||
url = https://github.com/otomadb/main-prisma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Builder | ||
FROM node:20.10.0-slim@sha256:e941e22afee9c5d1e96f7e3db939894c053f015e45ad9920793d78a6234dfe11 AS builder | ||
WORKDIR /build | ||
|
||
# install OpenSSL | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends openssl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./package.json ./package-lock.json ./ | ||
RUN npm ci --ignore-scripts | ||
|
||
COPY . . | ||
RUN npm run build | ||
|
||
# Runner | ||
FROM node:20.10.0-slim@sha256:e941e22afee9c5d1e96f7e3db939894c053f015e45ad9920793d78a6234dfe11 AS runner | ||
WORKDIR /app | ||
|
||
# hadolint ignore=DL3008 | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends openssl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## install tini | ||
ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini /bin/tini | ||
RUN chmod +x /bin/tini | ||
|
||
## install production-only node.js dependencies | ||
ENV NODE_ENV production | ||
|
||
## copy build dist | ||
COPY --from=builder /build/node_modules/.prisma/client/libquery_engine-debian-openssl-3.0.x.so.node ./node_modules/@prisma/client/libquery_engine-debian-openssl-3.0.x.so.node | ||
COPY --from=builder /build/dist ./dist | ||
|
||
ENTRYPOINT ["tini", "--"] | ||
CMD ["node", "./dist/main.mjs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import esbuild from "esbuild"; | ||
|
||
await esbuild.build({ | ||
logLevel: "info", | ||
bundle: true, | ||
entryPoints: ["./src/main.ts"], | ||
outdir: "./dist", | ||
outExtension: { ".js": ".mjs" }, | ||
platform: "node", | ||
format: "esm", | ||
minify: true, | ||
banner: { | ||
js: ` | ||
const require = (await import("node:module")).createRequire(import.meta.url); | ||
const __filename = (await import("node:url")).fileURLToPath(import.meta.url); | ||
const __dirname = (await import("node:path")).dirname(__filename); | ||
`, | ||
}, | ||
}); |
Oops, something went wrong.