Skip to content

Commit

Permalink
fix: update the workflow/Dockerfile for storybook so it's built on th…
Browse files Browse the repository at this point in the history
…e runner
  • Loading branch information
voodooGQ committed Aug 20, 2024
1 parent 26b8069 commit 4465d9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ jobs:
tags: |
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_SHA_TAG }}-release-${{ env.POSTFIX }}
# This is kind of "hacky", but we were having problems with the Dockerfile doing a
# correct build for Storybook. This will build it on the runner and then just copy
# over the folder
deploy-storybook-site:
needs: [setup, login]
runs-on: ubuntu-latest
Expand All @@ -147,6 +150,9 @@ jobs:
# pulls all commits (needed for lerna / semantic release to correctly version)
fetch-depth: "0"

- name: Build Storybook
run: 'NODE_OPTIONS=--openssl-legacy-provider yarn build:react'

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand All @@ -173,8 +179,6 @@ jobs:
POSTFIX: ${{ needs.setup.outputs.postfix }}
with:
file: ./packages/sage-react/Dockerfile
build-args: |
GITHUB_TOKEN=${{ secrets.ACCESS_TOKEN }}
context: ./packages/sage-react/
push: true
tags: |
Expand Down
25 changes: 7 additions & 18 deletions packages/sage-react/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ FROM alpine:3.17.0
ARG NONROOT_UID="1000"
ARG NONROOT_GID="1000"
ARG NODE_VERSION="18.20.4"
ARG YARN_VERSION="1.22.18"
ARG ARCH="x64"
ARG GITHUB_TOKEN

RUN apk add \
bash \
Expand All @@ -15,36 +13,27 @@ RUN apk add \
libxml2-dev \
libxslt-dev \
tzdata \
# Install node and yarn
# Install node
&& curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& rm node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz \
&& npm -g install yarn@${YARN_VERSION} \
&& apk del --force-broken-world \
&& rm -f /var/cache/apk/* \
&& addgroup -g $NONROOT_GID -S nonroot \
&& adduser -u $NONROOT_UID -S nonroot -G nonroot -h /workspace
&& adduser -u $NONROOT_UID -S nonroot -G nonroot -h /workspace \
&& npm install -g serve


RUN mkdir -p /app && chown nonroot:nonroot /app

WORKDIR /app
ENV HOME="/app"

ENV PORT ${PORT:-4100}
ENV NODE_PATH=lib

RUN echo "-----> Using .npmrc from config"
RUN npm config set @kajabi:registry https://npm.pkg.github.com
RUN npm config set '//npm.pkg.github.com/:_authToken' '${GITHUB_TOKEN}'

COPY --chown={$NONROOT_UID}:${NONROOT_GID} package.json /app/package.json
RUN yarn install --check-files

COPY --chown={$NONROOT_UID}:${NONROOT_GID} .babelrc /app/.babelrc
COPY --chown={$NONROOT_UID}:${NONROOT_GID} lib /app/lib
COPY --chown={$NONROOT_UID}:${NONROOT_GID} .storybook /app/.storybook
COPY --chown={$NONROOT_UID}:${NONROOT_GID} public /app/public
COPY --chown={$NONROOT_UID}:${NONROOT_GID} build /app/build

EXPOSE $PORT

CMD [ "yarn", "run", "storybook"]
CMD [ "serve", "/app/build" ]

0 comments on commit 4465d9f

Please sign in to comment.