-
Notifications
You must be signed in to change notification settings - Fork 1
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
8a5e38a
commit c55772d
Showing
3 changed files
with
42 additions
and
13 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 |
---|---|---|
|
@@ -13,10 +13,9 @@ jobs: | |
steps: | ||
# Check-out your repository. | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
|
||
|
||
### ⬇ IMPORTANT PART ⬇ ### | ||
### ⬇ IMPORTANT PART ⬇ ### | ||
|
||
- name: Build, Push and Release a Libro Lab Docker container to Heroku. # Your custom step name | ||
uses: gonuit/[email protected] # GitHub action name (leave it as it is). | ||
|
@@ -27,11 +26,11 @@ jobs: | |
# If you don't want to use repository secrets (which is recommended) you can do: | ||
# email: [email protected] | ||
email: ${{ secrets.HEROKU_EMAIL }} | ||
|
||
# Heroku API key associated with provided user's email. | ||
# Api Key is available under your Heroku account settings. | ||
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | ||
|
||
# Name of the heroku application to which the build is to be sent. | ||
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }} | ||
|
||
|
@@ -46,14 +45,11 @@ jobs: | |
|
||
# (Optional, default: "") | ||
# Additional options of docker build command. | ||
docker_options: "--no-cache" | ||
docker_options: '--no-cache' | ||
|
||
# (Optional, default: "web") | ||
# Select the process type for which you want the docker container to be uploaded. | ||
# By default, this argument is set to "web". | ||
# For more information look at https://devcenter.heroku.com/articles/process-model | ||
process_type: web | ||
|
||
|
||
|
||
### ⬆ IMPORTANT PART ⬆ ### | ||
### ⬆ IMPORTANT PART ⬆ ### |
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,9 +1,32 @@ | ||
# 使用 python 3.11 作为基础镜像 | ||
FROM python:3.11-slim-bookworm | ||
|
||
# 创建 ADMIN 用户并设置其为非特权用户 | ||
RUN useradd -m admin | ||
|
||
# 安装 libro 包 | ||
RUN pip install libro | ||
RUN mkdir -p ~/.jupyter | ||
COPY docker/jupyter_server_config.py ~/.jupyter/jupyter_server_config.py | ||
|
||
CMD ["libro", '--port', '8889',"--allow-root"] | ||
# 创建 Jupyter 配置目录和工作区目录 | ||
RUN mkdir -p /home/admin/.jupyter /home/admin/workspace | ||
|
||
# 复制 Jupyter 配置文件 | ||
COPY docker/jupyter_server_config.py /home/admin/.jupyter/jupyter_server_config.py | ||
|
||
# 复制启动脚本到镜像中 | ||
COPY docker/start.sh /home/admin/start.sh | ||
|
||
# 赋予启动脚本执行权限 | ||
RUN chmod +x /home/admin/start.sh | ||
|
||
# 更改文件和目录的所有权为 admin 用户 | ||
RUN chown -R admin:admin /home/admin | ||
|
||
# 切换到 admin 用户 | ||
USER admin | ||
|
||
# 设置工作目录为 admin 用户的主目录 | ||
WORKDIR /home/admin | ||
|
||
# 使用 ENTRYPOINT 来设置启动脚本 | ||
ENTRYPOINT ["/home/admin/start.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# 检查 PORT 环境变量是否设置 | ||
if [ -z "$PORT" ]; then | ||
echo "PORT 环境变量未设置" | ||
exit 1 | ||
fi | ||
|
||
# 启动 libro,并将 PORT 环境变量传递给它 | ||
exec libro --port="$PORT" |