dockerize it
This commit is contained in:
46
Dockerfile
Normal file
46
Dockerfile
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# Use Debian-based image with better build support
|
||||||
|
FROM node:16-bullseye AS builder
|
||||||
|
|
||||||
|
# Install system dependencies for node-canvas
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
python3 \
|
||||||
|
make \
|
||||||
|
g++ \
|
||||||
|
libcairo2-dev \
|
||||||
|
libpango1.0-dev \
|
||||||
|
libjpeg-dev \
|
||||||
|
libgif-dev \
|
||||||
|
librsvg2-dev \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Pin known working npm version
|
||||||
|
RUN npm install -g npm@8.19.4
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
|
||||||
|
# Use legacy peer deps to avoid vite conflict
|
||||||
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Optional: skip gen if it fails
|
||||||
|
RUN npm run gen || true
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ---- Runtime image ----
|
||||||
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/sharechess/sharechess"
|
||||||
|
|
||||||
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/sharechess.conf
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s \
|
||||||
|
CMD curl -f http://localhost/ || exit 1
|
||||||
|
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
sharechess:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: sharechess
|
||||||
|
ports:
|
||||||
|
- "8012:80"
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost/"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 5s
|
||||||
|
logging:
|
||||||
|
driver: json-file
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
38
index.html
38
index.html
@@ -3,47 +3,19 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
|
||||||
<!-- HTML Meta Tags -->
|
<!-- Minimal Meta Tags -->
|
||||||
<title>ShareChess</title>
|
<title>ShareChess</title>
|
||||||
<meta
|
<meta
|
||||||
name="description"
|
name="description"
|
||||||
content="ShareChess is a free, open source website that allows you to share chess games as self-contained replay links, PNG images, or GIF / MP4 / WebM animations."
|
content="ShareChess is a free, open source website that allows you to share chess games as self-contained replay links, PNG images, or GIF / MP4 / WebM animations."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Facebook Meta Tags -->
|
|
||||||
<meta property="og:url" content="https://sharechess.github.io/" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:title" content="ShareChess" />
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content="ShareChess is a free, open source website that allows you to share chess games as self-contained replay links, PNG images, or GIF / MP4 / WebM animations."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:image"
|
|
||||||
content="https://sharechess.github.io/img/baner.png"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Twitter Meta Tags -->
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
<meta property="twitter:domain" content="sharechess.github.io" />
|
|
||||||
<meta property="twitter:url" content="https://sharechess.github.io/" />
|
|
||||||
<meta name="twitter:title" content="ShareChess" />
|
|
||||||
<meta
|
|
||||||
name="twitter:description"
|
|
||||||
content="ShareChess is a free, open source website that allows you to share chess games as self-contained replay links, PNG images, or GIF / MP4 / WebM animations."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://sharechess.github.io/img/baner.png"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- Other Tags -->
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
||||||
<link rel="manifest" href="/manifest.json" />
|
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Favicons (local) -->
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<link
|
<link
|
||||||
rel="apple-touch-icon"
|
rel="apple-touch-icon"
|
||||||
type="image/png"
|
type="image/png"
|
||||||
@@ -62,6 +34,8 @@
|
|||||||
sizes="16x16"
|
sizes="16x16"
|
||||||
href="/img/icon-16x16.png"
|
href="/img/icon-16x16.png"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Keep the external icon stylesheet for Line Awesome icons -->
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="https://maxst.icons8.com/vue-static/landings/line-awesome/line-awesome/1.3.0/css/line-awesome.min.css"
|
href="https://maxst.icons8.com/vue-static/landings/line-awesome/line-awesome/1.3.0/css/line-awesome.min.css"
|
||||||
|
|||||||
16
nginx.conf
Normal file
16
nginx.conf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# nginx.conf
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN";
|
||||||
|
add_header X-Content-Type-Options "nosniff";
|
||||||
|
add_header Referrer-Policy "no-referrer-when-downgrade";
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
}
|
||||||
56
package-lock.json
generated
56
package-lock.json
generated
@@ -18,6 +18,7 @@
|
|||||||
"howler": "^2.2.3",
|
"howler": "^2.2.3",
|
||||||
"is-mobile": "^3.0.0",
|
"is-mobile": "^3.0.0",
|
||||||
"ua-parser-js": "^1.0.2",
|
"ua-parser-js": "^1.0.2",
|
||||||
|
"uuid": "^9.0.1",
|
||||||
"webm-writer": "^1.0.0"
|
"webm-writer": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
"mime": "^3.0.0",
|
"mime": "^3.0.0",
|
||||||
"npm": "^8.8.0",
|
"npm": "^8.8.0",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.7.0",
|
||||||
"typescript": "^4.4.4",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^2.7.2",
|
"vite": "^2.7.2",
|
||||||
"vite-plugin-solid": "^2.2.5"
|
"vite-plugin-solid": "^2.2.5"
|
||||||
}
|
}
|
||||||
@@ -7157,6 +7158,16 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tempfile/node_modules/uuid": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
||||||
|
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"uuid": "bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/through": {
|
"node_modules/through": {
|
||||||
"version": "2.3.8",
|
"version": "2.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||||
@@ -7291,16 +7302,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.6.3",
|
"version": "5.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||||
"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
|
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.2.0"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ua-parser-js": {
|
"node_modules/ua-parser-js": {
|
||||||
@@ -7359,13 +7370,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
"node_modules/uuid": {
|
||||||
"version": "3.4.0",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
"funding": [
|
||||||
"dev": true,
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"uuid": "bin/uuid"
|
"uuid": "dist/bin/uuid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/v8-compile-cache-lib": {
|
"node_modules/v8-compile-cache-lib": {
|
||||||
@@ -12663,6 +12676,14 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"temp-dir": "^1.0.0",
|
"temp-dir": "^1.0.0",
|
||||||
"uuid": "^3.0.1"
|
"uuid": "^3.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"uuid": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"through": {
|
"through": {
|
||||||
@@ -12756,9 +12777,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.6.3",
|
"version": "5.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||||
"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
|
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"ua-parser-js": {
|
"ua-parser-js": {
|
||||||
@@ -12798,10 +12819,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uuid": {
|
"uuid": {
|
||||||
"version": "3.4.0",
|
"version": "9.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"v8-compile-cache-lib": {
|
"v8-compile-cache-lib": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"mime": "^3.0.0",
|
"mime": "^3.0.0",
|
||||||
"npm": "^8.8.0",
|
"npm": "^8.8.0",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.7.0",
|
||||||
"typescript": "^4.4.4",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^2.7.2",
|
"vite": "^2.7.2",
|
||||||
"vite-plugin-solid": "^2.2.5"
|
"vite-plugin-solid": "^2.2.5"
|
||||||
},
|
},
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
"howler": "^2.2.3",
|
"howler": "^2.2.3",
|
||||||
"is-mobile": "^3.0.0",
|
"is-mobile": "^3.0.0",
|
||||||
"ua-parser-js": "^1.0.2",
|
"ua-parser-js": "^1.0.2",
|
||||||
|
"uuid": "^9.0.1",
|
||||||
"webm-writer": "^1.0.0"
|
"webm-writer": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -339,58 +339,7 @@ const Share: Component<{ handlers: Handlers; class?: string }> = (props) => {
|
|||||||
["Chrome", "Firefox", "Opera"].includes(state.browser as string)
|
["Chrome", "Firefox", "Opera"].includes(state.browser as string)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<hr />
|
{/* Removed Stylus install and board/pieces links */}
|
||||||
<h2>
|
|
||||||
Install this style via{" "}
|
|
||||||
<a
|
|
||||||
href={
|
|
||||||
state.browser === "Chrome"
|
|
||||||
? "https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne"
|
|
||||||
: state.browser === "Firefox"
|
|
||||||
? "https://addons.mozilla.org/pl/firefox/addon/styl-us/"
|
|
||||||
: "https://addons.opera.com/pl/extensions/details/stylus/"
|
|
||||||
}
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Stylus
|
|
||||||
</a>
|
|
||||||
</h2>
|
|
||||||
<p class="stylus">
|
|
||||||
Pieces:{" "}
|
|
||||||
<a
|
|
||||||
href={`stylus/pieces/${state.boardConfig.piecesStyle}_lichess.user.css`}
|
|
||||||
target="_blank"
|
|
||||||
title="Install"
|
|
||||||
>
|
|
||||||
lichess
|
|
||||||
</a>
|
|
||||||
<span className="delimiter"> | </span>
|
|
||||||
<a
|
|
||||||
href={`stylus/pieces/${state.boardConfig.piecesStyle}_chesscom.user.css`}
|
|
||||||
target="_blank"
|
|
||||||
title="Install"
|
|
||||||
>
|
|
||||||
chess.com
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<p class="stylus">
|
|
||||||
Board:
|
|
||||||
<a
|
|
||||||
href={`stylus/boards/${state.boardConfig.boardStyle}_lichess.user.css`}
|
|
||||||
target="_blank"
|
|
||||||
title="Install"
|
|
||||||
>
|
|
||||||
lichess
|
|
||||||
</a>
|
|
||||||
<span className="delimiter"> | </span>
|
|
||||||
<a
|
|
||||||
href={`stylus/boards/${state.boardConfig.boardStyle}_chesscom.user.css`}
|
|
||||||
target="_blank"
|
|
||||||
title="Install"
|
|
||||||
>
|
|
||||||
chess.com
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</Show>
|
</Show>
|
||||||
</Scrollable>
|
</Scrollable>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user