diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 3aff5041..31eeb66f 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -68,6 +68,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Build and push Docker image uses: docker/build-push-action@v4 with: @@ -78,4 +79,3 @@ jobs: ghcr.io/${{ github.repository_owner }}/flair:${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max - diff --git a/Dockerfile b/Dockerfile index cd548cca..7e9202f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,23 +14,17 @@ RUN apt-get update && apt-get install -y \ # 創建虛擬環境 RUN python3 -m venv /opt/venv -# 在虛擬環境中安裝 Flair (注意這裡改用完整路徑) +# 在虛擬環境中安裝 Flair RUN /opt/venv/bin/pip install flair # 安裝 R 依賴項 -RUN R -e "install.packages('remotes')" -RUN R -e "install.packages(c('data.table', 'reticulate', 'curl', 'attempt', 'htmltools', 'stringr'))" -RUN R -e "install.packages(c('knitr', 'rmarkdown', 'lsa', 'purrr', 'jsonlite', 'ggplot2', 'plotly', 'testthat'))" +RUN R -e "install.packages(c('remotes', \ + 'data.table', 'reticulate', 'curl', 'attempt', 'htmltools', 'stringr', \ + 'knitr', 'rmarkdown', 'lsa', 'purrr', 'jsonlite', 'ggplot2', 'plotly', 'testthat'), \ + repos='https://cloud.r-project.org/')" -# 複製 R 套件到容器中 -COPY . /usr/src/my_pkg -WORKDIR /usr/src/my_pkg - -# 安裝 R 套件 -RUN R -e "remotes::install_local(force = TRUE)" - -# 清理不必要的文件 -RUN rm -rf /usr/src/my_pkg +# 從 GitHub 安裝 flaiR +RUN R -e "remotes::install_github('davidycliao/flaiR', force = TRUE)" # 設定預設命令 CMD ["R"]