Skip to content

Commit

Permalink
added bundle file
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema committed Oct 6, 2024
1 parent b33dc47 commit cc6425d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
13 changes: 5 additions & 8 deletions github-action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions github-action/test/bundle/asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit cc6425d

Please sign in to comment.