Skip to content

Commit

Permalink
fix: resolve ARG scope and variable quoting issues in Dockerfile
Browse files Browse the repository at this point in the history
- Moved the ARG instruction inside the build stage where it is used.
- Surrounded $ASYNCAPI_GENERATOR_VERSION with double quotes to prevent word splitting and globbing issues.
- Improved maintainability and reliability by ensuring proper variable handling.
  • Loading branch information
Light13008 committed Oct 6, 2024
1 parent 4473874 commit a71fa0f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
ARG ASYNCAPI_GENERATOR_VERSION=1.10.9

FROM node:18-alpine

ARG ASYNCAPI_GENERATOR_VERSION="1.10.9" # Include ARG in the build stage and surround it with double quotes

WORKDIR /app

# Since 0.14.0 release of html-template chromium is needed for pdf generation
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium-browser
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium-browser"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"

# Since 0.30.0 release Git is supported and required as a dependency
# Since 0.14.0 release of html-template chromium is needed for pdf generation.
# More custom packages for specific template should not be added to this dockerfile. Instead, we should come up with some extensibility solution.
RUN apk --update add --no-cache git chromium && \
npm install -g @asyncapi/generator@$ASYNCAPI_GENERATOR_VERSION && \
npm install -g @asyncapi/generator@"$ASYNCAPI_GENERATOR_VERSION" && \ # Surround variable with double quotes
npm cache clean --force

# Define the entry point for the AsyncAPI generator
Expand Down

0 comments on commit a71fa0f

Please sign in to comment.