Skip to content

Commit

Permalink
Add storybook docker (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev authored Jan 3, 2025
1 parent 88a5f2f commit b6d9662
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
on:
push:
branches:
- main
paths:
- "Dockerfile.storybook"
pull_request:
paths:
- "Dockerfile.storybook"
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/storybook-env

jobs:
storybook-build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,format=long
type=ref,event=branch
type=ref,event=pr
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.storybook
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions Dockerfile.storybook
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM mcr.microsoft.com/playwright:v1.49.1

# Set environment variables
ENV CI=true \
TZ=UTC \
DISPLAY=:99

# Install additional dependencies
RUN apt-get update && \
apt-get install -y \
curl \
build-essential \
jq \
&& rm -rf /var/lib/apt/lists/*

# Install Rust and wasm-pack
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

# Add cargo to PATH
ENV PATH="/root/.cargo/bin:${PATH}"

# Install pnpm
RUN corepack enable pnpm

# Setup display with consistent resolution
RUN Xvfb :99 -screen 0 1280x1024x24 2>/dev/null &

WORKDIR /app

# Default command that can be overridden
CMD ["bash"]

0 comments on commit b6d9662

Please sign in to comment.