Skip to content

Commit 9613f97

Browse files
committed
storybook update try
1 parent 9eedb01 commit 9613f97

2 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/auto-test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
context: .
9494
file: ./client/Dockerfile.storybook
9595
push: true
96-
tags: docker.io/${{ secrets.DOCKERHUB_ADMIN_USERNAME }}/storybook:${{ env.TAG_NAME }}
96+
tags: docker.io/${{ secrets.DOCKERHUB_ADMIN_USERNAME }}/seb-server-gui-storybook:${{ env.TAG_NAME }}
9797

9898
build-and-push-e2e-runner:
9999
runs-on: ubuntu-latest

client/Dockerfile.storybook

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,46 @@
1-
# ---- Build static Storybook ----
2-
FROM node:20-alpine AS build
3-
WORKDIR /app
1+
# syntax=docker/dockerfile:1.7
42

5-
COPY client/package.json client/package-lock.json* ./client/
3+
############################
4+
# 1) Build Storybook static
5+
############################
6+
FROM node:20-alpine AS build
67
WORKDIR /app/client
78

9+
# Install deps (cached)
10+
COPY client/package.json client/package-lock.json ./
811
RUN npm ci
912

10-
COPY client/ .
13+
# Copy the rest
14+
COPY client/ ./
1115

16+
# Build static Storybook (outputs storybook-static/)
1217
RUN npm run build-storybook
1318

14-
# ---- Serve with nginx ----
15-
FROM nginx:alpine
16-
COPY --from=build /app/client/storybook-static /usr/share/nginx/html
19+
########################################
20+
# 2) Serve static files with nginx
21+
########################################
22+
FROM nginx:1.27-alpine
1723

18-
RUN printf 'server {\n\
19-
listen 80;\n\
20-
server_name _;\n\
21-
root /usr/share/nginx/html;\n\
22-
index index.html;\n\
23-
location / {\n\
24-
try_files $uri $uri/ /index.html;\n\
25-
}\n\
26-
}\n' > /etc/nginx/conf.d/default.conf
24+
# Replace default server config with SPA-friendly config
25+
RUN rm -f /etc/nginx/conf.d/default.conf && \
26+
printf 'server {\n\
27+
listen 80;\n\
28+
server_name _;\n\
29+
root /usr/share/nginx/html;\n\
30+
index index.html;\n\
31+
# Storybook is a SPA; fall back to index.html\n\
32+
location / {\n\
33+
try_files $uri $uri/ /index.html;\n\
34+
}\n\
35+
# Cache immutable assets aggressively\n\
36+
location ~* \\.(?:js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {\n\
37+
expires 30d;\n\
38+
add_header Cache-Control \"public, max-age=2592000, immutable\";\n\
39+
try_files $uri =404;\n\
40+
}\n\
41+
}\n' > /etc/nginx/conf.d/storybook.conf
42+
43+
# Copy build output
44+
COPY --from=build /app/client/storybook-static /usr/share/nginx/html
2745

2846
EXPOSE 80

0 commit comments

Comments
 (0)