diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index 168fcd6a2e..2b22e23b3c 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -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 @@ -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: @@ -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: | diff --git a/packages/sage-react/Dockerfile b/packages/sage-react/Dockerfile index 211937ee3a..daf9a0ed42 100644 --- a/packages/sage-react/Dockerfile +++ b/packages/sage-react/Dockerfile @@ -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 \ @@ -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" ]