Добавил докер образ

This commit is contained in:
Ilia Miheev
2026-08-01 22:48:29 +03:00
parent 7a54ac0c18
commit 3650ffa3cd
7 changed files with 140 additions and 4 deletions
+7 -4
View File
@@ -3,7 +3,8 @@ const path = require('path')
const ROOT = path.resolve(__dirname, '..')
const ENV_PATH = path.join(ROOT, '.env')
const OUT_PATH = path.join(ROOT, 'public', 'config.js')
const OUT_PATH =
process.env.CONFIG_OUT || path.join(ROOT, 'public', 'config.js')
const DEFAULTS = {
VUE_APP_NAME: 'irandom',
@@ -56,8 +57,9 @@ function parseEnvFile(filePath) {
return result
}
function buildConfig(env) {
const pick = (key) => env[key] || process.env[key] || DEFAULTS[key]
function buildConfig(fileEnv) {
// Container / shell env overrides .env file
const pick = (key) => process.env[key] || fileEnv[key] || DEFAULTS[key]
return {
name: pick('VUE_APP_NAME'),
@@ -88,5 +90,6 @@ const output = `/* Generated by scripts/generate-config.js — do not edit by ha
window.__APP_CONFIG__ = ${payload};
`
fs.mkdirSync(path.dirname(OUT_PATH), { recursive: true })
fs.writeFileSync(OUT_PATH, output, 'utf8')
console.log(`Wrote ${path.relative(ROOT, OUT_PATH)}`)
console.log(`Wrote ${OUT_PATH}`)