@joystick.js/cli-canary 0.0.0-canary.1665 → 0.0.0-canary.1667
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,11 +41,17 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
43
41
|
# Set the working directory in the container
|
|
44
42
|
WORKDIR /app
|
|
45
43
|
|
|
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
|
+
|
|
46
50
|
# Add build argument to invalidate cache
|
|
47
51
|
ARG CACHEBUST=1
|
|
48
52
|
|
|
49
|
-
# Copy the pre-built application
|
|
50
|
-
COPY ./.build
|
|
53
|
+
# Copy the rest of the pre-built application
|
|
54
|
+
COPY ./.build .
|
|
51
55
|
|
|
52
56
|
# Expose the port the app runs on
|
|
53
57
|
EXPOSE 2600
|
|
@@ -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.1667",
|
|
5
|
+
"canary_version": "0.0.0-canary.1666",
|
|
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,11 +41,17 @@ RUN if [ ! -z "$GLOBAL_NPM_PACKAGES" ]; then \
|
|
|
43
41
|
# Set the working directory in the container
|
|
44
42
|
WORKDIR /app
|
|
45
43
|
|
|
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
|
+
|
|
46
50
|
# Add build argument to invalidate cache
|
|
47
51
|
ARG CACHEBUST=1
|
|
48
52
|
|
|
49
|
-
# Copy the pre-built application
|
|
50
|
-
COPY ./.build
|
|
53
|
+
# Copy the rest of the pre-built application
|
|
54
|
+
COPY ./.build .
|
|
51
55
|
|
|
52
56
|
# Expose the port the app runs on
|
|
53
57
|
EXPOSE 2600
|
|
@@ -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")) {
|