@joystick.js/cli-canary 0.0.0-canary.1664 → 0.0.0-canary.1666
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Use
|
|
2
|
-
FROM
|
|
1
|
+
# Use Debian Slim as the base image
|
|
2
|
+
FROM debian:bullseye-slim
|
|
3
3
|
|
|
4
4
|
# Avoid prompts from apt
|
|
5
5
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
@@ -10,10 +10,8 @@ ENV NODE_VERSION=20.x
|
|
|
10
10
|
# Install Node.js 20 and common dependencies
|
|
11
11
|
RUN apt-get update && apt-get install -y \
|
|
12
12
|
curl \
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
git \
|
|
16
|
-
build-essential \
|
|
13
|
+
ca-certificates \
|
|
14
|
+
gnupg \
|
|
17
15
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
18
16
|
&& apt-get install -y nodejs \
|
|
19
17
|
&& apt-get clean \
|
|
@@ -43,8 +41,17 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
43
41
|
# Set the working directory in the container
|
|
44
42
|
WORKDIR /app
|
|
45
43
|
|
|
46
|
-
# Copy
|
|
47
|
-
COPY ./.build
|
|
44
|
+
# Copy package.json and package-lock.json (if available)
|
|
45
|
+
COPY ./.build/package*.json ./
|
|
46
|
+
|
|
47
|
+
# Install NPM dependencies
|
|
48
|
+
RUN npm ci --only=production
|
|
49
|
+
|
|
50
|
+
# Add build argument to invalidate cache
|
|
51
|
+
ARG CACHEBUST=1
|
|
52
|
+
|
|
53
|
+
# Copy the rest of the pre-built application
|
|
54
|
+
COPY ./.build .
|
|
48
55
|
|
|
49
56
|
# Expose the port the app runs on
|
|
50
57
|
EXPOSE 2600
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as
|
|
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.1666",
|
|
5
|
+
"canary_version": "0.0.0-canary.1665",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Use
|
|
2
|
-
FROM
|
|
1
|
+
# Use Debian Slim as the base image
|
|
2
|
+
FROM debian:bullseye-slim
|
|
3
3
|
|
|
4
4
|
# Avoid prompts from apt
|
|
5
5
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
@@ -10,10 +10,8 @@ ENV NODE_VERSION=20.x
|
|
|
10
10
|
# Install Node.js 20 and common dependencies
|
|
11
11
|
RUN apt-get update && apt-get install -y \
|
|
12
12
|
curl \
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
git \
|
|
16
|
-
build-essential \
|
|
13
|
+
ca-certificates \
|
|
14
|
+
gnupg \
|
|
17
15
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
18
16
|
&& apt-get install -y nodejs \
|
|
19
17
|
&& apt-get clean \
|
|
@@ -43,8 +41,17 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
43
41
|
# Set the working directory in the container
|
|
44
42
|
WORKDIR /app
|
|
45
43
|
|
|
46
|
-
# Copy
|
|
47
|
-
COPY ./.build
|
|
44
|
+
# Copy package.json and package-lock.json (if available)
|
|
45
|
+
COPY ./.build/package*.json ./
|
|
46
|
+
|
|
47
|
+
# Install NPM dependencies
|
|
48
|
+
RUN npm ci --only=production
|
|
49
|
+
|
|
50
|
+
# Add build argument to invalidate cache
|
|
51
|
+
ARG CACHEBUST=1
|
|
52
|
+
|
|
53
|
+
# Copy the rest of the pre-built application
|
|
54
|
+
COPY ./.build .
|
|
48
55
|
|
|
49
56
|
# Expose the port the app runs on
|
|
50
57
|
EXPOSE 2600
|
|
@@ -25,7 +25,7 @@ const build_docker_image = (
|
|
|
25
25
|
) => {
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
27
|
if (!check_docker_installation()) {
|
|
28
|
-
process.loader.print("Push requires Docker to deploy your app.
|
|
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.");
|
|
29
29
|
reject(new Error("Docker is not installed or not in the PATH"));
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
@@ -48,21 +48,29 @@ const build_docker_image = (
|
|
|
48
48
|
// Prepare build arguments for dependencies
|
|
49
49
|
const build_args = [
|
|
50
50
|
`CUSTOM_APT_DEPS=${apt_deps.join(' ')}`,
|
|
51
|
-
`GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}
|
|
51
|
+
`GLOBAL_NPM_PACKAGES=${npm_deps.join(' ')}`,
|
|
52
|
+
`CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache
|
|
52
53
|
].map(arg => `--build-arg ${arg}`).join(' ');
|
|
53
54
|
|
|
54
55
|
const command = `docker build ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
|
|
55
56
|
|
|
56
|
-
exec(command, (error, stdout, stderr) => {
|
|
57
|
+
exec(command, { stdio: ['pipe', 'pipe', 'pipe'] }, (error, stdout, stderr) => {
|
|
57
58
|
if (error) {
|
|
58
59
|
console.error(`Error building Docker image: ${error.message}`);
|
|
59
60
|
reject(error);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
|
|
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")) {
|
|
63
71
|
console.error(`Docker build stderr: ${stderr}`);
|
|
64
72
|
}
|
|
65
|
-
|
|
73
|
+
|
|
66
74
|
process.loader.print(`Successfully built Docker image: ${image_name}`);
|
|
67
75
|
resolve();
|
|
68
76
|
});
|