This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// Deploy front/dist/prod to host /data/www/userbase/front using the Docker daemon
|
||||
// Deploy front/dist to host /data/www/userbase/front using the Docker daemon
|
||||
// that act_runner already mounts into the job container (/var/run/docker.sock).
|
||||
//
|
||||
// Why this script exists:
|
||||
@@ -153,8 +153,8 @@ async function flushDebug() {
|
||||
|
||||
function resolveDistPath() {
|
||||
const candidates = [
|
||||
path.join(process.cwd(), 'front', 'dist', 'prod'),
|
||||
'/workspace/admin/userbase/front/dist/prod',
|
||||
path.join(process.cwd(), 'front', 'dist'),
|
||||
'/workspace/admin/userbase/front/dist',
|
||||
];
|
||||
for (const c of candidates) {
|
||||
if (fs.existsSync(c)) return c;
|
||||
@@ -201,13 +201,13 @@ async function main() {
|
||||
} catch (e) {
|
||||
dbg('ls err: ' + e.message);
|
||||
}
|
||||
throw new Error('built dist/prod not found under any candidate path');
|
||||
throw new Error('built dist not found under any candidate path');
|
||||
}
|
||||
dbg('dist dir=' + distDir);
|
||||
dbg('dist listing: ' + fs.readdirSync(distDir).join(' '));
|
||||
|
||||
// 3) tar of the built assets, fetched from THIS container's own filesystem.
|
||||
// We fetch WITHOUT a trailing slash so the tar contains a top-level "prod/"
|
||||
// We fetch WITHOUT a trailing slash so the tar contains a top-level "dist/"
|
||||
// folder; we then mv it into place (deterministic, no reliance on the
|
||||
// trailing-slash "contents only" quirk which this moby build ignores).
|
||||
const tar = await getArchive(jobId, distDir);
|
||||
@@ -226,10 +226,10 @@ async function main() {
|
||||
throw new Error('put archive failed: ' + put.status + ' ' + put.body);
|
||||
}
|
||||
|
||||
// 5) move staging/prod -> HOST_STATIC/front (deterministic top-level landing).
|
||||
// 5) move staging/dist -> HOST_STATIC/front (deterministic top-level landing).
|
||||
const mv = await runExec(
|
||||
HELPER_ID,
|
||||
`rm -rf ${HOST_STATIC}/front && mv ${STAGING}/prod ${HOST_STATIC}/front && rm -rf ${STAGING}`
|
||||
`rm -rf ${HOST_STATIC}/front && mv ${STAGING}/dist ${HOST_STATIC}/front && rm -rf ${STAGING}`
|
||||
);
|
||||
dbg('mv status=' + mv.status + ' out=' + mv.body.replace(/\n/g, ' | '));
|
||||
|
||||
@@ -237,12 +237,12 @@ async function main() {
|
||||
const verify = await runExec(
|
||||
HELPER_ID,
|
||||
`echo "count=$(find ${HOST_STATIC}/front -type f | wc -l)"; ` +
|
||||
`echo "has_stray_prod=$(test -d ${HOST_STATIC}/front/prod && echo YES || echo NO)"; ` +
|
||||
`echo "has_stray_dist=$(test -d ${HOST_STATIC}/front/dist && echo YES || echo NO)"; ` +
|
||||
`ls -la ${HOST_STATIC}/front | head -20`
|
||||
);
|
||||
dbg('verify output: ' + verify.body.replace(/\n/g, ' | '));
|
||||
|
||||
dbg('DEPLOY OK -> ' + HOST_STATIC + '/front (top-level, no prod/ nesting)');
|
||||
dbg('DEPLOY OK -> ' + HOST_STATIC + '/front (top-level, no dist/ nesting)');
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user