@joystick.js/cli-canary 0.0.0-canary.1666 → 0.0.0-canary.1668
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,24 +1,11 @@
|
|
|
1
|
-
# Use
|
|
2
|
-
FROM
|
|
1
|
+
# Use Node.js 20 Slim as the base image
|
|
2
|
+
FROM node:20-slim
|
|
3
3
|
|
|
4
4
|
# Avoid prompts from apt
|
|
5
5
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
6
|
|
|
7
|
-
# Set
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Install Node.js 20 and common dependencies
|
|
11
|
-
RUN apt-get update && apt-get install -y \
|
|
12
|
-
curl \
|
|
13
|
-
ca-certificates \
|
|
14
|
-
gnupg \
|
|
15
|
-
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
16
|
-
&& apt-get install -y nodejs \
|
|
17
|
-
&& apt-get clean \
|
|
18
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
19
|
-
|
|
20
|
-
# Verify Node.js version
|
|
21
|
-
RUN node --version
|
|
7
|
+
# Set the working directory in the container
|
|
8
|
+
WORKDIR /app
|
|
22
9
|
|
|
23
10
|
# Allow custom apt dependencies to be passed as build argument
|
|
24
11
|
ARG CUSTOM_APT_DEPS=""
|
|
@@ -38,9 +25,6 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
38
25
|
npm install -g $GLOBAL_NPM_PACKAGES; \
|
|
39
26
|
fi
|
|
40
27
|
|
|
41
|
-
# Set the working directory in the container
|
|
42
|
-
WORKDIR /app
|
|
43
|
-
|
|
44
28
|
# Copy package.json and package-lock.json (if available)
|
|
45
29
|
COPY ./.build/package*.json ./
|
|
46
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as f,execSync as m}from"child_process";import s from"path";import{fileURLToPath as
|
|
1
|
+
import{exec as f,execSync as m}from"child_process";import s from"path";import{fileURLToPath as p}from"url";import c from"fs";const k=p(import.meta.url),g=s.dirname(k),_=()=>{try{return m("docker --version",{stdio:"ignore"}),!0}catch{return!1}},$=(e="",i="",{apt_deps:d=[],npm_deps:l=[]}={})=>new Promise((a,r)=>{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."),r(new Error("Docker is not installed or not in the PATH"));return}process.loader.print("Building Docker image for deployment...");const t=s.join(g,"Dockerfile");if(!c.existsSync(t)){r(new Error(`Dockerfile not found at ${t}`));return}if(!i||!c.existsSync(s.join(i,".build"))){r(new Error("Invalid context path or .build directory not found"));return}const u=`docker build --quiet ${[`CUSTOM_APT_DEPS=${d.join(" ")}`,`GLOBAL_NPM_PACKAGES=${l.join(" ")}`,`CACHEBUST=${Date.now()}`].map(o=>`--build-arg ${o}`).join(" ")} -t ${e} -f "${t}" "${i}"`;f(u,{stdio:["ignore","pipe","pipe"]},(o,y,n)=>{if(o){console.error(`Error building Docker image: ${o.message}`),r(o);return}n.trim()&&!n.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")&&console.error(`Docker build stderr: ${n}`),process.loader.print(`Successfully built Docker image: ${e}`),a()})});var w=$;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.1668",
|
|
5
|
+
"canary_version": "0.0.0-canary.1667",
|
|
6
6
|
"description": "The CLI for Joystick.",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"bin": {
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
# Use
|
|
2
|
-
FROM
|
|
1
|
+
# Use Node.js 20 Slim as the base image
|
|
2
|
+
FROM node:20-slim
|
|
3
3
|
|
|
4
4
|
# Avoid prompts from apt
|
|
5
5
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
6
|
|
|
7
|
-
# Set
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# Install Node.js 20 and common dependencies
|
|
11
|
-
RUN apt-get update && apt-get install -y \
|
|
12
|
-
curl \
|
|
13
|
-
ca-certificates \
|
|
14
|
-
gnupg \
|
|
15
|
-
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
16
|
-
&& apt-get install -y nodejs \
|
|
17
|
-
&& apt-get clean \
|
|
18
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
19
|
-
|
|
20
|
-
# Verify Node.js version
|
|
21
|
-
RUN node --version
|
|
7
|
+
# Set the working directory in the container
|
|
8
|
+
WORKDIR /app
|
|
22
9
|
|
|
23
10
|
# Allow custom apt dependencies to be passed as build argument
|
|
24
11
|
ARG CUSTOM_APT_DEPS=""
|
|
@@ -38,9 +25,6 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
38
25
|
npm install -g $GLOBAL_NPM_PACKAGES; \
|
|
39
26
|
fi
|
|
40
27
|
|
|
41
|
-
# Set the working directory in the container
|
|
42
|
-
WORKDIR /app
|
|
43
|
-
|
|
44
28
|
# Copy package.json and package-lock.json (if available)
|
|
45
29
|
COPY ./.build/package*.json ./
|
|
46
30
|
|
|
@@ -52,19 +52,17 @@ const build_docker_image = (
|
|
|
52
52
|
`CACHEBUST=${Date.now()}` // Add timestamp to invalidate cache
|
|
53
53
|
].map(arg => `--build-arg ${arg}`).join(' ');
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
// Add --quiet flag to suppress verbose output
|
|
56
|
+
const command = `docker build --quiet ${build_args} -t ${image_name} -f "${dockerfile_path}" "${context_path}"`;
|
|
56
57
|
|
|
57
|
-
exec(command, { stdio: ['
|
|
58
|
+
exec(command, { stdio: ['ignore', 'pipe', 'pipe'] }, (error, stdout, stderr) => {
|
|
58
59
|
if (error) {
|
|
59
60
|
console.error(`Error building Docker image: ${error.message}`);
|
|
60
61
|
reject(error);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
//
|
|
65
|
-
if (stdout.trim()) {
|
|
66
|
-
process.loader.print(stdout);
|
|
67
|
-
}
|
|
65
|
+
// The --quiet flag will output only the image ID, which we can ignore
|
|
68
66
|
|
|
69
67
|
// Check if stderr contains actual error messages
|
|
70
68
|
if (stderr.trim() && !stderr.includes("Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them")) {
|