-
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.
Signed-off-by: Peter Solymos <psolymos@gmail.com>
- Loading branch information
Showing
3 changed files
with
55 additions
and
8 deletions.
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,50 @@ | ||
name: Build and Push Docker Image for faithful/py-shiny | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
paths: [ "py-shiny/**"] | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: [ "py-shiny/**"] | ||
|
||
env: | ||
SHINY_SETUP: py-shiny | ||
TAG: latest | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Docker metadata' | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
labels: | | ||
maintainer=Peter Solymos | ||
org.opencontainers.image.title=Faithful | ||
org.opencontainers.image.description=Old Faithful Shiny app | ||
org.opencontainers.image.vendor=Hosting Shiny Book Project | ||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Build and push' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./${{ env.SHINY_SETUP }} | ||
file: ./${{ env.SHINY_SETUP }}/Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}/${{ env.SHINY_SETUP }}:${{ env.TAG }} | ||
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 |
---|---|---|
@@ -1,23 +1,19 @@ | ||
FROM python:3.9 | ||
|
||
# Add user an change working directory and user | ||
RUN addgroup --system app && adduser --system --ingroup app app | ||
WORKDIR /home/app | ||
|
||
# Install requirements | ||
COPY app/requirements.txt . | ||
RUN pip install --no-cache-dir --upgrade -r requirements.txt | ||
|
||
# Copy the app | ||
COPY app . | ||
|
||
# Run app on port 8080 | ||
# RUN mkdir .config | ||
# ENV MPLCONFIGDIR=/home/app/.config | ||
RUN chown app:app -R /home/app | ||
USER app | ||
|
||
## Issue: if I set user to 'user' I get various errors... | ||
# USER app | ||
RUN mkdir .config | ||
ENV MPLCONFIGDIR=/home/app/.config | ||
ENV HOME=/home/app | ||
|
||
EXPOSE 3838 | ||
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3838"] |
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 @@ | ||
__pycache__ |