From cc6425dcae80259968dbc6ed95eecf6ef820beec Mon Sep 17 00:00:00 2001 From: akshatnema Date: Sun, 6 Oct 2024 18:06:29 +0530 Subject: [PATCH] added bundle file --- github-action/Dockerfile | 13 +++++-------- github-action/test/bundle/asyncapi.yaml | 10 ++++++++++ package.json | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 github-action/test/bundle/asyncapi.yaml diff --git a/github-action/Dockerfile b/github-action/Dockerfile index f669712e1d7..28e5d48cf4f 100644 --- a/github-action/Dockerfile +++ b/github-action/Dockerfile @@ -5,7 +5,7 @@ FROM node:18-alpine as build COPY ./ /tmp/source_code # Install dependencies -RUN cd /tmp/source_code && npm install +RUN cd /tmp/source_code && npm install --ignore-scripts # Build the source code RUN cd /tmp/source_code && npm run build @@ -15,7 +15,6 @@ RUN mkdir -p /libraries # Copy the lib, bin, node_modules, and package.json files to the /libraries directory RUN cp -r /tmp/source_code/lib /libraries -RUN cp -r /tmp/source_code/node_modules /libraries RUN cp -r /tmp/source_code/assets /libraries RUN cp /tmp/source_code/package.json /libraries RUN cp /tmp/source_code/package-lock.json /libraries @@ -30,17 +29,15 @@ RUN rm -rf /tmp/* FROM node:18-alpine # Install necessary packages -RUN apk add --no-cache bash git chromium +RUN apk add --no-cache bash git # Copy the libraries directory from the build stage COPY --from=build /libraries /libraries -# Environment variables for Puppeteer -ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true -ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser +RUN cd /libraries && npm install --production --ignore-scripts # Create a non-root user -RUN addgroup -S myuser && adduser -S myuser -G myuser +# RUN addgroup -S myuser && adduser -S myuser -G myuser # Create a script that runs the desired command RUN ln -s /libraries/bin/run_bin /usr/local/bin/asyncapi @@ -49,7 +46,7 @@ RUN ln -s /libraries/bin/run_bin /usr/local/bin/asyncapi RUN chmod +x /usr/local/bin/asyncapi # Change ownership to non-root user -RUN chown -R myuser:myuser /libraries /usr/local/bin/asyncapi || echo "Failed to change ownership" +# RUN chown -R myuser:myuser /libraries /usr/local/bin/asyncapi || echo "Failed to change ownership" # Copy the entrypoint script COPY github-action/entrypoint.sh /entrypoint.sh diff --git a/github-action/test/bundle/asyncapi.yaml b/github-action/test/bundle/asyncapi.yaml new file mode 100644 index 00000000000..6907e7a16e7 --- /dev/null +++ b/github-action/test/bundle/asyncapi.yaml @@ -0,0 +1,10 @@ +asyncapi: "2.5.0" +info: + title: Account Service + version: 1.0.0 + description: This service is in charge of processing user signups +channels: + user/signedup: + subscribe: + message: + $ref: "./test/bundle/messages.yaml#/messages/UserSignedUp" \ No newline at end of file diff --git a/package.json b/package.json index bdadc215878..15f47abd99b 100644 --- a/package.json +++ b/package.json @@ -175,7 +175,7 @@ "get-version": "echo $npm_package_version", "createhook": "oclif generate hook myhook --event=command_not_found", "createhookinit": "oclif generate hook inithook --event=init", - "action:docker:build": "npm run build && docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .", + "action:docker:build": "docker build -f github-action/Dockerfile -t asyncapi/github-action-for-cli:latest .", "action:bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", "action:test": "cd github-action && make test" },