@joystick.js/cli-canary 0.0.0-canary.1663 → 0.0.0-canary.1664
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,10 @@ 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
45
|
|
|
46
46
|
# Copy the pre-built application
|
|
47
|
-
COPY ./.build
|
|
47
|
+
COPY ./.build /app
|
|
48
48
|
|
|
49
49
|
# Expose the port the app runs on
|
|
50
50
|
EXPOSE 2600
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{exec as m,execSync 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 m,execSync as p}from"child_process";import t from"path";import{fileURLToPath as k}from"url";import c from"fs";const g=k(import.meta.url),_=t.dirname(g),$=()=>{try{return p("docker --version",{stdio:"ignore"}),!0}catch{return!1}},b=(e="",i="",{apt_deps:d=[],npm_deps:l=[]}={})=>new Promise((a,o)=>{if(!$()){process.loader.print("Push requires Docker to deploy your app. 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=t.join(_,"Dockerfile");if(!c.existsSync(n)){o(new Error(`Dockerfile not found at ${n}`));return}if(!i||!c.existsSync(t.join(i,".build"))){o(new Error("Invalid context path or .build directory not found"));return}const u=`docker build ${[`CUSTOM_APT_DEPS=${d.join(" ")}`,`GLOBAL_NPM_PACKAGES=${l.join(" ")}`].map(r=>`--build-arg ${r}`).join(" ")} -t ${e} -f "${n}" "${i}"`;m(u,(r,f,s)=>{if(r){console.error(`Error building Docker image: ${r.message}`),o(r);return}s&&console.error(`Docker build stderr: ${s}`),process.loader.print(f),process.loader.print(`Successfully built Docker image: ${e}`),a()})});var E=b;export{E 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.1664",
|
|
5
|
+
"canary_version": "0.0.0-canary.1663",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -41,10 +41,10 @@ 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
45
|
|
|
46
46
|
# Copy the pre-built application
|
|
47
|
-
COPY ./.build
|
|
47
|
+
COPY ./.build /app
|
|
48
48
|
|
|
49
49
|
# Expose the port the app runs on
|
|
50
50
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return process.exit();
|
|
28
|
+
process.loader.print("Push requires Docker to deploy your app. Visit https://docs.docker.com/get-started/get-docker/ to download docker for your OS.");
|
|
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,13 +39,19 @@ 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
51
|
`GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`
|
|
47
52
|
].map(arg => `--build-arg ${arg}`).join(' ');
|
|
48
53
|
|
|
49
|
-
const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path
|
|
54
|
+
const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
|
|
50
55
|
|
|
51
56
|
exec(command, (error, stdout, stderr) => {
|
|
52
57
|
if (error) {
|