Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup deployment for storybook #1316

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions govtool/frontend/storybook.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:18-alpine as deps
ARG NPMRC_TOKEN

WORKDIR /src

# Set npm configuration settings using environment variables
RUN npm config set @intersect.mbo:registry "https://registry.npmjs.org/" --location=global \
&& npm config set //registry.npmjs.org/:_authToken ${NPMRC_TOKEN} --location=global

COPY package.json package-lock.json ./
RUN npm install

FROM node:18-alpine as builder
ARG NPMRC_TOKEN
ENV NODE_OPTIONS=--max_old_space_size=8192
WORKDIR /src

COPY --from=deps /src/node_modules ./node_modules
COPY . .

RUN npm run build-storybook --quiet

FROM nginx:stable-alpine
EXPOSE 80

COPY --from=builder /src/storybook-static /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]
1 change: 1 addition & 0 deletions tests/test-infrastructure/build-and-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ then
update-service govtool_backend "$BASE_IMAGE_NAME"/backend:${GOVTOOL_TAG}
update-service govtool_frontend "$BASE_IMAGE_NAME"/frontend:${GOVTOOL_TAG}
update-service govtool_metadata-validation "$BASE_IMAGE_NAME"/metadata-validation:${GOVTOOL_TAG}
update-service govtool_storybook "$BASE_IMAGE_NAME"/storybook:${GOVTOOL_TAG}

update-service govaction-loader_backend "$BASE_IMAGE_NAME"/gov-action-loader-backend:${GOVTOOL_TAG}
update-service govaction-loader_frontend "$BASE_IMAGE_NAME"/gov-action-loader-frontend:${GOVTOOL_TAG}
Expand Down
17 changes: 16 additions & 1 deletion tests/test-infrastructure/docker-compose-govtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
context: ../../govtool/metadata-validation
environment:
VIRTUAL_HOST: https://${BASE_DOMAIN}/metadata-validation/ -> :3000
PORT: '3000'
PORT: "3000"
networks:
- frontend
deploy:
Expand All @@ -68,3 +68,18 @@ services:
placement:
constraints:
- node.labels.govtool==true
storybook:
image: govtool/storybook:${GOVTOOL_TAG}
build:
context: ../../govtool/frontend
dockerfile: storybook.Dockerfile
args:
NPMRC_TOKEN: ${NPMRC_TOKEN}
environment:
VIRTUAL_HOST: https://storybook-${BASE_DOMAIN}
deploy:
restart_policy:
delay: "30s"
placement:
constraints:
- node.labels.govtool==true