-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DSD-DBS/storybook
MVP with React + FastAPI
- Loading branch information
Showing
83 changed files
with
3,378 additions
and
571 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Create and publish Docker image | ||
|
||
on: | ||
push: | ||
branches: ['**'] | ||
tags: ['v*.*.*'] | ||
|
||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | ||
env: | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
# | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }}/model-explorer | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,3 +156,8 @@ dmypy.json | |
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
node_modules/ | ||
|
||
# Mac stuff | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug CapellaModelExplorer Backend", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"console": "integratedTerminal", | ||
"envFile": ".env", | ||
"pythonArgs": ["-Xdev"], | ||
"module": "capella_model_explorer.backend", | ||
"args": ["MODELPATH", "./templates"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Copyright DB InfraGO AG and contributors | ||
SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Build frontend | ||
FROM node:20 as build-frontend | ||
WORKDIR /app | ||
COPY frontend/package*.json ./ | ||
RUN npm install | ||
COPY frontend/ ./ | ||
RUN npm run build | ||
|
||
# Build backend | ||
FROM python:3.12-slim-bookworm | ||
WORKDIR /app | ||
COPY ./capella_model_explorer ./capella_model_explorer | ||
COPY ./pyproject.toml ./ | ||
COPY ./.git ./.git | ||
|
||
USER root | ||
|
||
RUN apt-get update && \ | ||
apt-get install --yes --no-install-recommends \ | ||
git \ | ||
git-lfs \ | ||
libgirepository1.0-dev \ | ||
libcairo2-dev \ | ||
gir1.2-pango-1.0 \ | ||
graphviz \ | ||
nodejs \ | ||
npm && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip install . | ||
COPY --from=build-frontend /app/dist/ ./frontend/dist/ | ||
|
||
# Expose the port the app runs in | ||
EXPOSE 8000 | ||
|
||
COPY ./templates /views | ||
|
||
# Cache directory has to be writable | ||
RUN chmod -R 777 /home | ||
ENV HOME=/home | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENV MODEL_ENTRYPOINT=/model | ||
RUN chmod -R 777 ./frontend/dist/ | ||
|
||
# Run as non-root user per default | ||
USER 1001 | ||
|
||
# Pre-install npm dependencies for context diagrams | ||
RUN python -c "from capellambse_context_diagrams import _elkjs; _elkjs._install_required_npm_pkg_versions()" | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
Oops, something went wrong.