-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fde940
commit 02e90ed
Showing
4 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
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,62 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
workflow_dispatch: | ||
inputs: | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
type: choice | ||
options: | ||
- info | ||
- warning | ||
- debug | ||
tags: | ||
description: 'Manual run' | ||
required: false | ||
type: boolean | ||
jobs: | ||
publish: | ||
name: Publish to ghcr.io | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- dockerfile: ./Dockerfile | ||
image: ghcr.io/${{ github.repository }}/kg_dashboard | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker meta | ||
uses: docker/metadata-action@v4 | ||
id: meta | ||
with: | ||
images: ${{ matrix.image }} | ||
tags: | | ||
type=raw,value={{date 'YYYYMMDD'}} | ||
- name: Log in | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: "${{ github.event_name != 'pull_request' }}" | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
file: ${{ matrix.dockerfile }} |
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,34 @@ | ||
# Select base image (can be ubuntu, python, shiny etc) | ||
FROM python:3.12-slim | ||
|
||
# Create user name and home directory variables. | ||
# The variables are later used as $USER and $HOME. | ||
ENV USER=username | ||
ENV HOME=/home/$USER | ||
|
||
# Add user to system | ||
RUN useradd -m -u 1000 $USER | ||
|
||
# Set working directory (this is where the code should go) | ||
WORKDIR $HOME/kg | ||
|
||
# Update system and install dependencies. | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
build-essential \ | ||
software-properties-common | ||
|
||
# Copy code and start script (this will place the files in home/username/) | ||
COPY requirements.txt $HOME/kg/requirements.txt | ||
COPY webapp $HOME/kg/webapp/ | ||
COPY data/ $HOME/kg/data/ | ||
COPY start-script.sh $HOME/kg/start-script.sh | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt \ | ||
&& chmod +x start-script.sh \ | ||
&& chown -R $USER:$USER $HOME \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
USER $USER | ||
EXPOSE 8501 | ||
|
||
ENTRYPOINT ["./start-script.sh"] |
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,3 @@ | ||
#!/bin/bash | ||
|
||
streamlit run webapp/AMR-KG_Database.py --server.port=8501 --server.address=0.0.0.0 |