mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
add docker image for build environment
This commit is contained in:
parent
0bc51cebc1
commit
e802728b44
|
|
@ -33,6 +33,7 @@ jobs:
|
|||
name: Prevent from loading rubygems from TUNA
|
||||
run: |
|
||||
sed -i "/^source/c source 'https://rubygems.org'" Gemfile
|
||||
sed -i '/remote:/s@remote: .*$@remote: https://rubygems.org@' Gemfile.lock
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
*.swp
|
||||
*~
|
||||
/Gemfile.lock
|
||||
/.jekyll-metadata
|
||||
/static/tunasync.json
|
||||
/static/status/
|
||||
|
|
@ -17,4 +16,3 @@
|
|||
/node_modules/
|
||||
/.jekyll-cache/
|
||||
_stats.html
|
||||
/_src/components.d.ts
|
||||
|
|
|
|||
|
|
@ -3,17 +3,24 @@ FROM ruby:3.2
|
|||
RUN mkdir /data
|
||||
WORKDIR /data
|
||||
|
||||
RUN apt-get update
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install --no-install-recommends -y locales && \
|
||||
apt-get clean
|
||||
RUN curl -fsSL "https://cdn.jsdelivr.net/gh/tj/n@7.3.0/bin/n#v14.17.1" | bash -s -- lts
|
||||
|
||||
COPY Gemfile /data/
|
||||
COPY Gemfile Gemfile.lock package.json package-lock.json /data/
|
||||
COPY _node_module_patch /data/_node_module_patch
|
||||
|
||||
RUN gem install bundler
|
||||
RUN bundle install
|
||||
RUN \
|
||||
gem install bundler && \
|
||||
bundle install --frozen && \
|
||||
NODE_ENV=production npm ci && \
|
||||
mv node_modules ../ && \
|
||||
rm -rf /data/*
|
||||
|
||||
# Fix https://github.com/babel/ruby-babel-transpiler/issues/294
|
||||
RUN sed -i 's/@context ||= ExecJS.compile("var self = this; " + File.read(script_path))/@context ||= ExecJS.compile("var self = this; " + File.read(script_path, :encoding => "UTF-8"))/' /usr/local/bundle/gems/babel-transpiler-0.7.0/lib/babel/transpiler.rb
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANG C.UTF-8
|
||||
ENV JEKYLL_ENV production
|
||||
ENV VITE_RUBY_VITE_BIN_PATH /node_modules/.bin/vite
|
||||
|
||||
CMD ["jekyll", "build"]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
GEM
|
||||
remote: https://mirrors.tuna.tsinghua.edu.cn/rubygems/
|
||||
specs:
|
||||
addressable (2.8.6)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.7)
|
||||
colorator (1.1.0)
|
||||
concurrent-ruby (1.2.3)
|
||||
cssminify2 (2.0.1)
|
||||
csv (3.3.0)
|
||||
dry-cli (0.7.0)
|
||||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
eventmachine (1.2.7)
|
||||
execjs (2.9.1)
|
||||
ffi (1.16.3)
|
||||
forwardable-extended (2.6.0)
|
||||
google-protobuf (3.23.4)
|
||||
htmlcompressor (0.4.0)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.14.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jekyll (4.3.3)
|
||||
addressable (~> 2.4)
|
||||
colorator (~> 1.0)
|
||||
em-websocket (~> 0.5)
|
||||
i18n (~> 1.0)
|
||||
jekyll-sass-converter (>= 2.0, < 4.0)
|
||||
jekyll-watch (~> 2.0)
|
||||
kramdown (~> 2.3, >= 2.3.1)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
liquid (~> 4.0)
|
||||
mercenary (>= 0.3.6, < 0.5)
|
||||
pathutil (~> 0.9)
|
||||
rouge (>= 3.0, < 5.0)
|
||||
safe_yaml (~> 1.0)
|
||||
terminal-table (>= 1.8, < 4.0)
|
||||
webrick (~> 1.7)
|
||||
jekyll-fontawesome-svg (0.4.0)
|
||||
jekyll-minifier (0.1.10)
|
||||
cssminify2 (~> 2.0)
|
||||
htmlcompressor (~> 0.4)
|
||||
jekyll (>= 3.5)
|
||||
json-minify (~> 0.0.3)
|
||||
uglifier (~> 4.1)
|
||||
jekyll-paginate (1.1.0)
|
||||
jekyll-relative-links (0.7.0)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-sass-converter (3.0.0)
|
||||
sass-embedded (~> 1.54)
|
||||
jekyll-sitemap (1.4.0)
|
||||
jekyll (>= 3.7, < 5.0)
|
||||
jekyll-titles-from-headings (0.5.3)
|
||||
jekyll (>= 3.3, < 5.0)
|
||||
jekyll-watch (2.2.1)
|
||||
listen (~> 3.0)
|
||||
json (2.7.2)
|
||||
json-minify (0.0.3)
|
||||
json (> 0)
|
||||
kramdown (2.4.0)
|
||||
rexml
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
liquid (4.0.4)
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
mercenary (0.4.0)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (5.0.5)
|
||||
rack (3.0.10)
|
||||
rack-proxy (0.7.7)
|
||||
rack
|
||||
rake (13.2.1)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rexml (3.2.6)
|
||||
rouge (3.30.0)
|
||||
safe_yaml (1.0.5)
|
||||
sass-embedded (1.58.3)
|
||||
google-protobuf (~> 3.21)
|
||||
rake (>= 10.0.0)
|
||||
terminal-table (3.0.2)
|
||||
unicode-display_width (>= 1.1.1, < 3)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (2.5.0)
|
||||
vite_ruby (3.5.0)
|
||||
dry-cli (>= 0.7, < 2)
|
||||
rack-proxy (~> 0.6, >= 0.6.1)
|
||||
zeitwerk (~> 2.2)
|
||||
webrick (1.8.1)
|
||||
zeitwerk (2.6.13)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
base64 (~> 0.2.0)
|
||||
bigdecimal (~> 3.1, >= 3.1.7)
|
||||
csv (~> 3.3)
|
||||
jekyll (~> 4.3, >= 4.3.3)
|
||||
jekyll-fontawesome-svg (~> 0.4.0)
|
||||
jekyll-minifier (~> 0.1.10)
|
||||
jekyll-paginate (~> 1.1)
|
||||
jekyll-relative-links (~> 0.7.0)
|
||||
jekyll-sitemap (~> 1.4)
|
||||
jekyll-titles-from-headings (~> 0.5.3)
|
||||
vite_ruby (~> 3.2)
|
||||
webrick (~> 1.8)
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.22
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# Jekyll plugin for generating Git hash
|
||||
#
|
||||
# Place this file in the _plugins directory and
|
||||
# use {{ site.data['hash'] }} in your Liquid templates
|
||||
#
|
||||
# Author: Yegor Bugayenko <yegor@tpc2.com>
|
||||
# Source: http://github.com/yegor256/jekyll-git-hash
|
||||
#
|
||||
# Distributed under the MIT license
|
||||
# Copyright Yegor Bugayenko, 2014
|
||||
|
||||
module Jekyll
|
||||
class GitHashGenerator < Generator
|
||||
priority :high
|
||||
safe true
|
||||
def generate(site)
|
||||
hash = %x( git rev-parse --short HEAD ).strip
|
||||
site.data['hash'] = hash
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
"include": ["**/*.ts", "**/*.js", "**/*.vue"],
|
||||
"files": [
|
||||
"../node_modules/njs-types/ngx_http_js_module.d.ts",
|
||||
"components.d.ts",
|
||||
"../.jekyll-cache/vite-components.d.ts",
|
||||
"lib/shims/vue.d.ts",
|
||||
"lib/shims/jekyll.d.ts",
|
||||
"lib/shims/jekyll.d.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"isolatedModules": true,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import { build as viteBuild, normalizePath } from "vite";
|
|||
import glob from "fast-glob";
|
||||
import { getBabelOutputPlugin } from "@rollup/plugin-babel";
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
import Typescript from "typescript";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const visualizer = await (async () => {
|
||||
if (process.env.VISUALIZER) {
|
||||
|
|
@ -44,6 +46,44 @@ const jekyllData = Object.fromEntries(
|
|||
);
|
||||
jekyllData.config.hasOwnProperty("suffix") || (jekyllData.config.suffix = null);
|
||||
|
||||
const tsConfig = (() => {
|
||||
const tsconfigPath = path.join("_src", "tsconfig.json");
|
||||
return {
|
||||
tsconfig: tsconfigPath,
|
||||
filterRoot: false,
|
||||
typescript: {
|
||||
...Typescript,
|
||||
readConfigFile(filename, readFile) {
|
||||
const result = Typescript.readConfigFile(filename, readFile);
|
||||
if (result.error) {
|
||||
return result;
|
||||
}
|
||||
result.config.files ??= [];
|
||||
result.config.files = result.config.files.map((file) => {
|
||||
const tsconfigDir = resolve(__dirname, path.dirname(tsconfigPath));
|
||||
const resolvedFile = resolve(tsconfigDir, file);
|
||||
const nodeModuleDir = resolve(__dirname, "node_modules");
|
||||
const jekyllCacheDir = resolve(__dirname, ".jekyll-cache");
|
||||
|
||||
const relativeNodeModule = path.relative(nodeModuleDir, resolvedFile);
|
||||
if (!relativeNodeModule.startsWith("../")) {
|
||||
return fileURLToPath(import.meta.resolve(relativeNodeModule));
|
||||
}
|
||||
const relativeJekyllCache = path.relative(
|
||||
jekyllCacheDir,
|
||||
resolvedFile,
|
||||
);
|
||||
if (!relativeJekyllCache.startsWith("../")) {
|
||||
return resolve(jekyllData.config.cache_dir, relativeJekyllCache);
|
||||
}
|
||||
return resolvedFile;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
||||
export default defineConfig(({ mode }) => ({
|
||||
build: {
|
||||
emptyOutDir: true,
|
||||
|
|
@ -94,9 +134,7 @@ export default defineConfig(({ mode }) => ({
|
|||
},
|
||||
};
|
||||
})(),
|
||||
typescript({
|
||||
tsconfig: path.join("_src", "tsconfig.json"),
|
||||
}),
|
||||
typescript(tsConfig),
|
||||
vue({
|
||||
template: {
|
||||
preprocessCustomRequire(id) {
|
||||
|
|
@ -144,6 +182,7 @@ export default defineConfig(({ mode }) => ({
|
|||
components({
|
||||
dirs: [resolve(__dirname, "_src/components")],
|
||||
resolvers: [],
|
||||
dts: resolve(jekyllData.config.cache_dir, "vite-components.d.ts"),
|
||||
}),
|
||||
(() => {
|
||||
const savedConfig = {
|
||||
|
|
@ -181,9 +220,7 @@ export default defineConfig(({ mode }) => ({
|
|||
configFile: false,
|
||||
logLevel,
|
||||
plugins: [
|
||||
typescript({
|
||||
tsconfig: path.join(root, "tsconfig.json"),
|
||||
}),
|
||||
typescript(tsConfig),
|
||||
getBabelOutputPlugin({
|
||||
presets: ["babel-preset-njs"],
|
||||
plugins: ["./_src/babel-njs/index.mjs"],
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"@babel/core": "^7.24.4",
|
||||
"@babel/preset-env": "^7.24.4",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@vitejs/plugin-legacy": "^5.3.2",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@webcomponents/template": "^1.5.1",
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
"liquidjs": "^10.10.2",
|
||||
"markup-js": "^1.5.21",
|
||||
"mustache": "^4.2.0",
|
||||
"njs-types": "^0.8.2",
|
||||
"patch-package": "^8.0.0",
|
||||
"promise-polyfill": "^8.3.0",
|
||||
"sass": "^1.74.1",
|
||||
|
|
@ -33,6 +35,8 @@
|
|||
"source-code-pro": "^2.38.0",
|
||||
"terser": "^5.30.3",
|
||||
"timeago.js": "^4.0.2",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.2.8",
|
||||
"vite-plugin-ruby": "^5.0.0",
|
||||
|
|
@ -40,12 +44,8 @@
|
|||
"whatwg-fetch": "^3.6.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"njs-types": "^0.8.2",
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5"
|
||||
"rollup-plugin-visualizer": "^5.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
|
|
@ -2199,7 +2199,6 @@
|
|||
"version": "11.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz",
|
||||
"integrity": "sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
"resolve": "^1.22.1"
|
||||
|
|
@ -3754,8 +3753,7 @@
|
|||
"node_modules/njs-types": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/njs-types/-/njs-types-0.8.2.tgz",
|
||||
"integrity": "sha512-6uv1Tcb4khW45LHZqj5vu1uo7WbvB6nINZjDVmryOxiO3K7rDMqRVNJbYtLHOKNbGDqLygIip9iYZbFViIVGqA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-6uv1Tcb4khW45LHZqj5vu1uo7WbvB6nINZjDVmryOxiO3K7rDMqRVNJbYtLHOKNbGDqLygIip9iYZbFViIVGqA=="
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
|
|
@ -4494,14 +4492,12 @@
|
|||
"node_modules/tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||
"dev": true
|
||||
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.4.5",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz",
|
||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||
"devOptional": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
10
package.json
10
package.json
|
|
@ -10,6 +10,7 @@
|
|||
"@babel/core": "^7.24.4",
|
||||
"@babel/preset-env": "^7.24.4",
|
||||
"@rollup/plugin-babel": "^6.0.4",
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"@vitejs/plugin-legacy": "^5.3.2",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@webcomponents/template": "^1.5.1",
|
||||
|
|
@ -26,6 +27,7 @@
|
|||
"liquidjs": "^10.10.2",
|
||||
"markup-js": "^1.5.21",
|
||||
"mustache": "^4.2.0",
|
||||
"njs-types": "^0.8.2",
|
||||
"patch-package": "^8.0.0",
|
||||
"promise-polyfill": "^8.3.0",
|
||||
"sass": "^1.74.1",
|
||||
|
|
@ -33,6 +35,8 @@
|
|||
"source-code-pro": "^2.38.0",
|
||||
"terser": "^5.30.3",
|
||||
"timeago.js": "^4.0.2",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.2.8",
|
||||
"vite-plugin-ruby": "^5.0.0",
|
||||
|
|
@ -40,11 +44,7 @@
|
|||
"whatwg-fetch": "^3.6.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^11.1.6",
|
||||
"njs-types": "^0.8.2",
|
||||
"prettier": "^3.2.5",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.4.5"
|
||||
"rollup-plugin-visualizer": "^5.12.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue