Skip to content

Commit

Permalink
Merge pull request #2 from Sean-Stilwell/ghcr-switch
Browse files Browse the repository at this point in the history
Adding GitHub Actions
  • Loading branch information
Sean-Stilwell authored Jun 14, 2024
2 parents 143f9d7 + f88ca57 commit c592339
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 20 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-dash-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and Push Dash App Image to GHCR

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:latest

- name: Image digest
run: echo "Image digest is ${{ steps.docker_build.outputs.digest }}"

- name: Image URL
run: echo "Image URL is ghcr.io/${{ github.repository }}:latest"

- name: Logout of GitHub Container Registry
run: docker logout ghcr.io
41 changes: 21 additions & 20 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

# Initialize the Dash app
app = dash.Dash(__name__,
requests_pathname_prefix="/webapp-DIE3/",
routes_pathname_prefix="/webapp-DIE3/")
requests_pathname_prefix="/webapp-DW1/",
routes_pathname_prefix="/webapp-DW1/")

KEY_VAULT_URL = "https://fsdh-proj-dw1-poc-kv.vault.azure.net/"
error_occur = False
Expand All @@ -26,38 +26,39 @@
DB_PASS = secret_client.get_secret("datahub-psql-password").value
except Exception as e:
error_occur = True
print(f"An error occurred: {e}")
print(f"An error occurred: {e} | Une erreur s'est produite: {e}")

# Define the layout of the app
app.layout = html.Div([
html.H1('Sample FSDH Dash Application | Exemple d\'une application Dash sur le DHSF'),
# Form 1 - Query database
html.H1('Celestial Body Database Query'),
html.P('The database contains information about celestial bodies. Enter the name of a celestial body to query the database.'),
dcc.Input(id='query-name', type='text', placeholder='Celestial body name'),
html.Button('Query Database', id='query-button', n_clicks=0),
html.H2('Celestial Body Database Query | Requête de la base de données des corps célestes'),
html.P('The database contains information about celestial bodies. Enter the name of a celestial body to query the database. | La base de données contient des informations sur les corps célestes. Entrez le nom d\'un corps céleste pour interroger la base de données.'),
dcc.Input(id='query-name', type='text', placeholder='Celestial body name | Nom du corps céleste'),
html.Button('Query Database | Interroger la base de données', id='query-button', n_clicks=0),
html.Div(id='query-output'),

# Figure 1 - Plot celestial bodies
html.H2('Celestial Bodies Plot'),
html.P('The plot shows the mass of celestial bodies against their distance from the sun.'),
html.H3('Celestial Bodies Plot | Tracé des corps célestes'),
html.P('The plot shows the mass of celestial bodies against their distance from the sun. | Le graphique montre la masse des corps célestes par rapport à leur distance par rapport au soleil.'),
dcc.Graph(id='celestial-bodies-plot'),

# Form 2 - Add new celestial body
html.H1('Add New Celestial Body'),
html.P('Add a new celestial body to the database.'),
dcc.Input(id='add-name', type='text', placeholder='Name'),
dcc.Input(id='add-type', type='text', placeholder='Type'),
dcc.Input(id='add-radius', type='number', placeholder='Radius'),
dcc.Input(id='add-mass', type='number', placeholder='Mass'),
dcc.Input(id='add-distance', type='number', placeholder='Distance from sun'),
html.Button('Add Celestial Body', id='add-button', n_clicks=0),
html.H1('Add New Celestial Body | Ajouter un nouveau corps céleste'),
html.P('Add a new celestial body to the database. | Ajoutez un nouveau corps céleste à la base de données.'),
dcc.Input(id='add-name', type='text', placeholder='Name | Nom'),
dcc.Input(id='add-type', type='text', placeholder='Type | Type'),
dcc.Input(id='add-radius', type='number', placeholder='Radius | Rayon'),
dcc.Input(id='add-mass', type='number', placeholder='Mass | Masse'),
dcc.Input(id='add-distance', type='number', placeholder='Distance from sun | Distance par rapport au soleil'),
html.Button('Add Celestial Body | Ajouter un corps céleste', id='add-button', n_clicks=0),
html.Div(id='add-output'),

# Form 3 - Delete celestial body by ID
html.H1('Delete Celestial Body'),
html.P('Delete a celestial body from the database by ID.'),
html.H1('Delete Celestial Body | Supprimer un corps céleste'),
html.P('Delete a celestial body from the database by ID. | Supprimez un corps céleste de la base de données par ID.'),
dcc.Input(id='delete-id', type='number', placeholder='ID'),
html.Button('Delete Celestial Body', id='delete-button', n_clicks=0),
html.Button('Delete Celestial Body | Supprimer un corps céleste', id='delete-button', n_clicks=0),
html.Div(id='delete-output')

], style={'width': '50%', 'margin': 'auto', 'font-family': 'Arial, sans-serif'})
Expand Down

0 comments on commit c592339

Please sign in to comment.