Skip to content
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
33 changes: 33 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Versioning and metadata
.git
.gitignore

# Dependencies
node_modules

# Dist directories
build
lib
storybook-static

# Environment variables (may contain sensitive data)
.env

# IDE-specific settings directories
.idea
.vscode

# Files and directories not required for production
.github
.husky
Dockerfile
.dockerignore
README.md
.editorconfig
.prettierrc
.eslintrc
.lintstagedrc
.nvmrc
.stylelintrc
rollup.config.mjs
babel.config.rollup.js
35 changes: 35 additions & 0 deletions .github/workflows/cloud-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Build Storybook & push to Cloud.ru Artifact Registry'

on:
push:
branches: ['master']
pull_request:
branches: ['master']
workflow_dispatch:

jobs:
build:
name: 'Build & push Storybook Docker image to Cloud.ru Artifact Registry'
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.REGISTRY_NAME }}/${{ vars.REPOSITORY_NAME }}

- name: Login to Cloud.ru Artifact Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_NAME }}
username: ${{ secrets.CLOUD_RU_ID }}
password: ${{ secrets.CLOUD_RU_SECRET }}

- name: Build and push Docker image
id: build_push
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

CI=true npm run test --passWithNoTests --silent
CI=true npm run test -- --passWithNoTests --silent
10 changes: 9 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const config = {
docs: false,
},
},
'@storybook/preset-create-react-app',
{
name: '@storybook/addon-docs',
options: {
Expand All @@ -32,12 +31,21 @@ const config = {
},
],

docs: {
autodocs: 'tag',
defaultName: 'Documentation',
},

staticDirs: ['../public/assets'],

framework: {
name: '@storybook/react-vite',
},

typescript: {
reactDocgen: 'react-docgen-typescript',
},

features: {
autoDocs: true,
},
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Build Stage
FROM node:20-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build:docs
RUN npm prune --production

# Production Stage
FROM nginxinc/nginx-unprivileged:stable-alpine AS production
COPY --from=build /app/storybook-static /usr/share/nginx/html
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
Loading