From 0f5c2344d6645f6fe5820b4d2cbdabb135637a4e Mon Sep 17 00:00:00 2001 From: mewu Date: Wed, 25 Sep 2024 16:05:15 -0700 Subject: [PATCH] add steps for venv --- .github/workflows/publish.yml | 33 ++++++++++++++++++--------------- Dockerfile | 4 ++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cace446..b7c94e8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,30 +25,33 @@ jobs: run: | docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace demo-quarto-image bash -c " echo 'Creating gallery directory...' - mkdir -p gallery && \ + mkdir -p gallery && chmod -R 777 gallery && \ echo 'gallery directory created.' - - FOLDERS=(python R) - echo 'Folders to process: ${FOLDERS[@]}' + + source /opt/venv/bin/activate + echo 'activated virtualenv.' + + FOLDERS=(python r) + echo 'Folders to process: \${FOLDERS[@]}' for FOLDER in \"\${FOLDERS[@]}\"; do - echo 'Searching for .qmd and .ipynb files in $FOLDER...' - find \"\$FOLDER\" \( -name '*.qmd' -o -name '*.ipynb' \) | while read file; do + echo \"Searching for .qmd and .ipynb files in \$FOLDER...\" + find \"\$FOLDER\" \( -name '*.qmd' -o -name '*.ipynb' \) | while read -r file; do - echo 'Processing file: $file' - target_dir='gallery/$(dirname \"$file\")' - echo 'Creating target directory: $target_dir' - mkdir -p \"\$target_dir\" && echo 'Directory $target_dir created.' + echo \"Processing file: \$file\" + target_dir=\"gallery/\$(dirname \"\$file\")\" + echo \"Creating target directory: \$target_dir\" + mkdir -p \"\$target_dir\" && echo \"Directory \$target_dir created.\" - echo 'Attempting to render $file with execution...' + echo \"Attempting to render \$file with execution...\" if quarto render \"\$file\" --to html --output-dir \"\$target_dir\"; then - echo 'Successfully rendered $file with execution.' + echo \"Successfully rendered \$file with execution.\" else - echo 'Failed to render $file with execution. Rendering without execution...' + echo \"Failed to render \$file with execution. Rendering without execution...\" if quarto render \"\$file\" --to html --no-execute --output-dir \"\$target_dir\"; then - echo 'Successfully rendered $file without execution.' + echo \"Successfully rendered \$file without execution.\" else - echo 'Rendering failed for $file, even without execution.' + echo \"Rendering failed for \$file, even without execution.\" fi fi diff --git a/Dockerfile b/Dockerfile index 1e44689..3b8b04c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,10 @@ RUN dpkg -i quarto-1.5.57-linux-amd64.deb WORKDIR /app COPY r /app/r +COPY python /app/python + +# Install python packages in venv +RUN /opt/venv/bin/pip install -r python/requirements.txt EXPOSE 8787 EXPOSE 8888