mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-05 05:55:36 +05:00
feat: add Dockerfile
This commit is contained in:
parent
767121c77b
commit
ed20227b1a
9 changed files with 144 additions and 7 deletions
68
.dockerignore
Normal file
68
.dockerignore
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# Python
|
||||||
|
__pycache__
|
||||||
|
venv
|
||||||
|
.mypy_cache
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.VSCode
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# DetaSpace
|
||||||
|
.space
|
||||||
|
|
||||||
|
# NextJS
|
||||||
|
## dependencies
|
||||||
|
standalone
|
||||||
|
node_modules
|
||||||
|
.pnp
|
||||||
|
.pnp.js
|
||||||
|
.yarn/install-state.gz
|
||||||
|
|
||||||
|
## testing
|
||||||
|
coverage
|
||||||
|
|
||||||
|
## next.js
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
## production
|
||||||
|
build
|
||||||
|
|
||||||
|
## misc
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
|
|
||||||
|
## debug
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
## local env files
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
## vercel
|
||||||
|
.vercel
|
||||||
|
|
||||||
|
## typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
next-env.d.ts
|
||||||
|
|
||||||
|
# traefik
|
||||||
|
traefik/traefik
|
||||||
|
|
||||||
|
old/
|
||||||
|
#Trigger Vercel Prod Build
|
||||||
|
|
||||||
|
# next-video
|
||||||
|
videos/*
|
||||||
|
!videos/*.json
|
||||||
|
!videos/*.js
|
||||||
|
!videos/*.ts
|
||||||
|
public/_next-video
|
||||||
|
|
||||||
|
API-Trace/*
|
||||||
|
.env
|
||||||
|
|
||||||
|
player-parsers
|
||||||
|
docs
|
||||||
|
.git
|
32
Dockerfile
Normal file
32
Dockerfile
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
FROM node:23-alpine AS base
|
||||||
|
|
||||||
|
|
||||||
|
FROM base AS deps
|
||||||
|
RUN apk add --no-cache libc6-compat
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
|
FROM base AS runner
|
||||||
|
LABEL org.opencontainers.image.source=https://github.com/radiquum/anix
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
RUN addgroup --system --gid 1001 nodejs
|
||||||
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
USER nextjs
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
ENV PORT=3000
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
|
CMD ["node", "server.js"]
|
|
@ -4,7 +4,13 @@ import { usePreferencesStore } from "./store/preferences";
|
||||||
import { Navbar } from "./components/Navbar/NavbarUpdate";
|
import { Navbar } from "./components/Navbar/NavbarUpdate";
|
||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from "flowbite-react";
|
import {
|
||||||
|
Button,
|
||||||
|
Modal,
|
||||||
|
ModalBody,
|
||||||
|
ModalFooter,
|
||||||
|
ModalHeader,
|
||||||
|
} from "flowbite-react";
|
||||||
import { Spinner } from "./components/Spinner/Spinner";
|
import { Spinner } from "./components/Spinner/Spinner";
|
||||||
import { ChangelogModal } from "#/components/ChangelogModal/ChangelogModal";
|
import { ChangelogModal } from "#/components/ChangelogModal/ChangelogModal";
|
||||||
import { Bounce, ToastContainer } from "react-toastify";
|
import { Bounce, ToastContainer } from "react-toastify";
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { tryCatchPlayer, tryCatchAPI } from "#/api/utils";
|
import { tryCatchPlayer, tryCatchAPI } from "#/api/utils";
|
||||||
|
import { env } from 'next-runtime-env';
|
||||||
|
|
||||||
export async function _fetchAPI(
|
export async function _fetchAPI(
|
||||||
url: string,
|
url: string,
|
||||||
|
@ -75,7 +76,8 @@ export const _fetchKodikManifest = async (
|
||||||
setPlayerError: (state) => void
|
setPlayerError: (state) => void
|
||||||
) => {
|
) => {
|
||||||
// Fetch episode links via edge function
|
// Fetch episode links via edge function
|
||||||
if (!process.env.NEXT_PUBLIC_KODIK_PARSER_URL) {
|
const NEXT_PUBLIC_KODIK_PARSER_URL = env("NEXT_PUBLIC_KODIK_PARSER_URL")
|
||||||
|
if (!NEXT_PUBLIC_KODIK_PARSER_URL) {
|
||||||
setPlayerError({
|
setPlayerError({
|
||||||
message: "Источник не настроен",
|
message: "Источник не настроен",
|
||||||
detail: "переменная 'NEXT_PUBLIC_KODIK_PARSER_URL' не обнаружена",
|
detail: "переменная 'NEXT_PUBLIC_KODIK_PARSER_URL' не обнаружена",
|
||||||
|
@ -84,7 +86,7 @@ export const _fetchKodikManifest = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await _fetchPlayer(
|
const data = await _fetchPlayer(
|
||||||
`${process.env.NEXT_PUBLIC_KODIK_PARSER_URL}/?url=${url}&player=kodik`,
|
`${NEXT_PUBLIC_KODIK_PARSER_URL}/?url=${url}&player=kodik`,
|
||||||
setPlayerError
|
setPlayerError
|
||||||
);
|
);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -213,9 +215,10 @@ export const _fetchAnilibriaManifest = async (
|
||||||
const epid = url.split("?id=")[1].split("&ep=")[1];
|
const epid = url.split("?id=")[1].split("&ep=")[1];
|
||||||
const _url = `https://api.anilibria.tv/v3/title?id=${id}`;
|
const _url = `https://api.anilibria.tv/v3/title?id=${id}`;
|
||||||
let data = null;
|
let data = null;
|
||||||
if (process.env.NEXT_PUBLIC_ANILIBRIA_PARSER_URL) {
|
const NEXT_PUBLIC_ANILIBRIA_PARSER_URL = env("NEXT_PUBLIC_ANILIBRIA_PARSER_URL")
|
||||||
|
if (NEXT_PUBLIC_ANILIBRIA_PARSER_URL) {
|
||||||
data = await _fetchPlayer(
|
data = await _fetchPlayer(
|
||||||
`${process.env.NEXT_PUBLIC_ANILIBRIA_PARSER_URL}/?url=${_url}&player=libria`,
|
`${NEXT_PUBLIC_ANILIBRIA_PARSER_URL}/?url=${_url}&player=libria`,
|
||||||
setPlayerError
|
setPlayerError
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -243,7 +246,8 @@ export const _fetchSibnetManifest = async (
|
||||||
setPlayerError: (state) => void
|
setPlayerError: (state) => void
|
||||||
) => {
|
) => {
|
||||||
// Fetch data via cloud endpoint
|
// Fetch data via cloud endpoint
|
||||||
if (!process.env.NEXT_PUBLIC_SIBNET_PARSER_URL) {
|
const NEXT_PUBLIC_SIBNET_PARSER_URL = env("NEXT_PUBLIC_SIBNET_PARSER_URL")
|
||||||
|
if (!NEXT_PUBLIC_SIBNET_PARSER_URL) {
|
||||||
setPlayerError({
|
setPlayerError({
|
||||||
message: "Источник не настроен",
|
message: "Источник не настроен",
|
||||||
detail: "переменная 'NEXT_PUBLIC_SIBNET_PARSER_URL' не обнаружена",
|
detail: "переменная 'NEXT_PUBLIC_SIBNET_PARSER_URL' не обнаружена",
|
||||||
|
@ -251,7 +255,7 @@ export const _fetchSibnetManifest = async (
|
||||||
return { manifest: null, poster: null };
|
return { manifest: null, poster: null };
|
||||||
}
|
}
|
||||||
const data = await _fetchPlayer(
|
const data = await _fetchPlayer(
|
||||||
`${process.env.NEXT_PUBLIC_SIBNET_PARSER_URL}/?url=${url}&player=sibnet`,
|
`${NEXT_PUBLIC_SIBNET_PARSER_URL}/?url=${url}&player=sibnet`,
|
||||||
setPlayerError
|
setPlayerError
|
||||||
);
|
);
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import { App } from "./App";
|
import { App } from "./App";
|
||||||
import { ThemeModeScript } from "flowbite-react";
|
import { ThemeModeScript } from "flowbite-react";
|
||||||
|
import { PublicEnvScript } from 'next-runtime-env';
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
metadataBase: new URL("https://anix.wah.su"),
|
metadataBase: new URL("https://anix.wah.su"),
|
||||||
|
@ -33,6 +34,7 @@ export default function RootLayout({ children }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en" suppressHydrationWarning>
|
<html lang="en" suppressHydrationWarning>
|
||||||
<head>
|
<head>
|
||||||
|
<PublicEnvScript />
|
||||||
<ThemeModeScript />
|
<ThemeModeScript />
|
||||||
</head>
|
</head>
|
||||||
<App>{children}</App>
|
<App>{children}</App>
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
const withFlowbiteReact = require("flowbite-react/plugin/nextjs");
|
const withFlowbiteReact = require("flowbite-react/plugin/nextjs");
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const NextConfig = {
|
const NextConfig = {
|
||||||
|
output: "standalone",
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
images: {
|
images: {
|
||||||
unoptimized: true,
|
unoptimized: true,
|
||||||
},
|
},
|
||||||
|
env: {
|
||||||
|
NEXT_PUBLIC_KODIK_PARSER_URL: process.env.NEXT_PUBLIC_KODIK_PARSER_URL,
|
||||||
|
NEXT_PUBLIC_ANILIBRIA_PARSER_URL: process.env.NEXT_PUBLIC_ANILIBRIA_PARSER_URL,
|
||||||
|
NEXT_PUBLIC_SIBNET_PARSER_URL: process.env.NEXT_PUBLIC_SIBNET_PARSER_URL,
|
||||||
|
},
|
||||||
async headers() {
|
async headers() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|
15
package-lock.json
generated
15
package-lock.json
generated
|
@ -17,6 +17,7 @@
|
||||||
"markdown-to-jsx": "^7.4.7",
|
"markdown-to-jsx": "^7.4.7",
|
||||||
"media-chrome": "^4.9.0",
|
"media-chrome": "^4.9.0",
|
||||||
"next": "^14.2.26",
|
"next": "^14.2.26",
|
||||||
|
"next-runtime-env": "^3.3.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-cropper": "^2.3.3",
|
"react-cropper": "^2.3.3",
|
||||||
|
@ -4955,6 +4956,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/next-runtime-env": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/next-runtime-env/-/next-runtime-env-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-JgKVnog9mNbjbjH9csVpMnz2tB2cT5sLF+7O47i6Ze/s/GoiKdV7dHhJHk1gwXpo6h5qPj5PTzryldtSjvrHuQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"next": "^14",
|
||||||
|
"react": "^18"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"next": "^14",
|
||||||
|
"react": "^18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/next/node_modules/postcss": {
|
"node_modules/next/node_modules/postcss": {
|
||||||
"version": "8.4.31",
|
"version": "8.4.31",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"markdown-to-jsx": "^7.4.7",
|
"markdown-to-jsx": "^7.4.7",
|
||||||
"media-chrome": "^4.9.0",
|
"media-chrome": "^4.9.0",
|
||||||
"next": "^14.2.26",
|
"next": "^14.2.26",
|
||||||
|
"next-runtime-env": "^3.3.0",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-cropper": "^2.3.3",
|
"react-cropper": "^2.3.3",
|
||||||
|
|
|
@ -9,4 +9,7 @@ RUN npm ci
|
||||||
|
|
||||||
COPY *.ts ./
|
COPY *.ts ./
|
||||||
|
|
||||||
|
EXPOSE 7000
|
||||||
|
ENV PORT=7000
|
||||||
|
ENV HOSTNAME="0.0.0.0"
|
||||||
CMD ["npm", "run", "serve"]
|
CMD ["npm", "run", "serve"]
|
Loading…
Add table
Add a link
Reference in a new issue