@joystick.js/cli-canary 0.0.0-canary.1663 → 0.0.0-canary.1665
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,10 +41,13 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
41
41
|
fi
|
|
42
42
|
|
|
43
43
|
# Set the working directory in the container
|
|
44
|
-
WORKDIR
|
|
44
|
+
WORKDIR /app
|
|
45
|
+
|
|
46
|
+
# Add build argument to invalidate cache
|
|
47
|
+
ARG CACHEBUST=1
|
|
45
48
|
|
|
46
49
|
# Copy the pre-built application
|
|
47
|
-
COPY ./.build
|
|
50
|
+
COPY ./.build /app
|
|
48
51
|
|
|
49
52
|
# Expose the port the app runs on
|
|
50
53
|
EXPOSE 2600
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{exec as
|
|
2
|
-
`),process.loader.print("Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS."),console.log(`
|
|
3
|
-
`),process.exit();process.loader.print("Building Docker image for deployment...");const e=n.join(c,"Dockerfile");if(!g.existsSync(e)){i(new Error(`Dockerfile not found at ${e}`));return}const u=`docker build ${[`CUSTOM_APT_DEPS=${l.join(" ")}`,`GLOBAL_NPM_PACKAGES=${d.join(" ")}`].map(o=>`--build-arg ${o}`).join(" ")} -t ${r} -f "${e}" "${s||c}"`;m(u,(o,p,t)=>{if(o){console.error(`Error building Docker image: ${o.message}`),i(o);return}t&&console.error(`Docker build stderr: ${t}`),process.loader.print(p),process.loader.print(`Successfully built Docker image: ${r}`),a()})});var x=D;export{x as default};
|
|
1
|
+
import{exec as f,execSync as m}from"child_process";import s from"path";import{fileURLToPath as k}from"url";import d from"fs";const g=k(import.meta.url),_=s.dirname(g),$=()=>{try{return m("docker --version",{stdio:"ignore"}),!0}catch{return!1}},b=(e="",i="",{apt_deps:l=[],npm_deps:a=[]}={})=>new Promise((u,o)=>{if(!$()){process.loader.print("Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS."),o(new Error("Docker is not installed or not in the PATH"));return}process.loader.print("Building Docker image for deployment...");const n=s.join(_,"Dockerfile");if(!d.existsSync(n)){o(new Error(`Dockerfile not found at ${n}`));return}if(!i||!d.existsSync(s.join(i,".build"))){o(new Error("Invalid context path or .build directory not found"));return}const p=`docker build ${[`CUSTOM_APT_DEPS=${l.join(" ")}`,`GLOBAL_NPM_PACKAGES=${a.join(" ")}`,`CACHEBUST=${Date.now()}`].map(r=>`--build-arg ${r}`).join(" ")} -t ${e} -f "${n}" "${i}"`;f(p,{stdio:["pipe","pipe","pipe"]},(r,c,t)=>{if(r){console.error(`Error building Docker image: ${r.message}`),o(r);return}c.trim()&&process.loader.print(c),t.trim()&&!t.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")&&console.error(`Docker build stderr: ${t}`),process.loader.print(`Successfully built Docker image: ${e}`),u()})});var w=b;export{w as default};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joystick.js/cli-canary",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-canary.
|
|
5
|
-
"canary_version": "0.0.0-canary.
|
|
4
|
+
"version": "0.0.0-canary.1665",
|
|
5
|
+
"canary_version": "0.0.0-canary.1664",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -41,10 +41,13 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
41
41
|
fi
|
|
42
42
|
|
|
43
43
|
# Set the working directory in the container
|
|
44
|
-
WORKDIR
|
|
44
|
+
WORKDIR /app
|
|
45
|
+
|
|
46
|
+
# Add build argument to invalidate cache
|
|
47
|
+
ARG CACHEBUST=1
|
|
45
48
|
|
|
46
49
|
# Copy the pre-built application
|
|
47
|
-
COPY ./.build
|
|
50
|
+
COPY ./.build /app
|
|
48
51
|
|
|
49
52
|
# Expose the port the app runs on
|
|
50
53
|
EXPOSE 2600
|
|
@@ -25,10 +25,9 @@ const build_docker_image = (
|
|
|
25
25
|
) => {
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
27
|
if (!check_docker_installation()) {
|
|
28
|
-
console.log('\n');
|
|
29
28
|
process.loader.print("Push requires Docker to deploy your app. Please visit https://docs.docker.com/get-started/get-docker/ to download Docker for your OS.");
|
|
30
|
-
|
|
31
|
-
return
|
|
29
|
+
reject(new Error("Docker is not installed or not in the PATH"));
|
|
30
|
+
return;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
process.loader.print('Building Docker image for deployment...');
|
|
@@ -40,24 +39,38 @@ const build_docker_image = (
|
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
42
41
|
|
|
42
|
+
// Ensure context_path is set and contains the .build directory
|
|
43
|
+
if (!context_path || !fs.existsSync(path.join(context_path, '.build'))) {
|
|
44
|
+
reject(new Error('Invalid context path or .build directory not found'));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
// Prepare build arguments for dependencies
|
|
44
49
|
const build_args = [
|
|
45
50
|
`CUSTOM_APT_DEPS=${apt_deps.join(' ')}`,
|
|
46
|
-
`GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}
|
|
51
|
+
`GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`,
|
|
52
|
+
`CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache
|
|
47
53
|
].map(arg => `--build-arg ${arg}`).join(' ');
|
|
48
54
|
|
|
49
|
-
const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path
|
|
55
|
+
const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
|
|
50
56
|
|
|
51
|
-
exec(command, (error, stdout, stderr) => {
|
|
57
|
+
exec(command, { stdio: ['pipe', 'pipe', 'pipe'] }, (error, stdout, stderr) => {
|
|
52
58
|
if (error) {
|
|
53
59
|
console.error(`Error building Docker image: ${error.message}`);
|
|
54
60
|
reject(error);
|
|
55
61
|
return;
|
|
56
62
|
}
|
|
57
|
-
|
|
63
|
+
|
|
64
|
+
// Only log stdout if it's not empty
|
|
65
|
+
if (stdout.trim()) {
|
|
66
|
+
process.loader.print(stdout);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Check if stderr contains actual error messages
|
|
70
|
+
if (stderr.trim() && !stderr.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")) {
|
|
58
71
|
console.error(`Docker build stderr: ${stderr}`);
|
|
59
72
|
}
|
|
60
|
-
|
|
73
|
+
|
|
61
74
|
process.loader.print(`Successfully built Docker image: ${image_name}`);
|
|
62
75
|
resolve();
|
|
63
76
|
});
|