Trigger repo2docker to build a Jupyter enabled Docker image from your GitHub repository and push this image to a Docker registry of your choice. This will automatically attempt to build an environment from configuration files found in your repository in the manner described here.
Read the full docs on repo2docker for more information: https://repo2docker.readthedocs.io
Images generated by this action are automatically tagged with both latest
and <SHA>
corresponding to the relevant commit SHA on GitHub. Both tags are pushed to the Docker registry specified by the user. If an existing image with the latest
tag already exists in your registry, this Action attempts to pull that image as a cache to reduce uncessary build steps.
You can use this Action to pre-cache Docker images to a Docker registry that you can reference in your repo. For example if you have the file Dockerfile
in the binder/
directory relative to the root of your repository with the following contents, this will allow Binder to start quickly by pulling an image you have already built:
# This is the image that is built and pushed by this Action (replace this with your image name)
FROM myorg/myimage:latest
...
See the examples section is very helpful for understanding the inputs and outputs of this Action.
DOCKER_USERNAME
:description: Docker registry username. If not supplied, credentials must be setup ahead of time.DOCKER_PASSWORD
:description: Docker registry password or access token (recommended). If not supplied, credentials must be setup ahead of time.DOCKER_REGISTRY
:description: domain name of the docker registry. If not supplied, this defaults to DockerHubIMAGE_NAME
:name of the image. Example - myusername/myContainer. If not supplied, this defaults to <DOCKER_USERNAME>/<GITHUB_REPOSITORY_NAME>
or <GITHUB_ACTOR>/<GITHUB_REPOSITORY_NAME>
.NOTEBOOK_USER
:description: username of the primary user in the image. If this is not specified, this is set to joyvan
. NOTE: This value is also overriden with jovyan
if the parameters BINDER_CACHE
or MYBINDERORG_TAG
are provided.REPO_DIR
:Path inside the image where contents of the repositories are copied to, and where all the build operations (such as postBuild) happen. Defaults to /home/<NOTEBOOK_USER>
if not set.APPENDIX_FILE
:Path to file containing Dockerfile commands to run at the end of the build. Can be used to customize the resulting image after all standard build steps finish.LATEST_TAG_OFF
:Setting this variable to any value will prevent your image from being tagged with latest
. Note that your image is always tagged with the GitHub commit SHA.ADDITIONAL_TAG
:An optional string that specifies the name of an additional tag you would like to apply to the image. Images are already tagged with the relevant GitHub commit SHA.NO_PUSH
:Setting this variable to any value will prevent any images from being pushed to a registry. Furthermore, verbose logging will be enabled in this mode. This is disabled by default.BINDER_CACHE
:Setting this variable to any value will add the file binder/Dockerfile
that references the docker image that was pushed to the registry by this Action. You cannot use this option if the parameter NO_PUSH
is set. This is disabled by default.
Note: This Action assumes you are not explicitly using Binder to build your dependencies (You are using this Action to build your dependencies). If a directory binder
with other files other than Dockerfile
or a directory named .binder/
is detected, this step will be aborted. This Action does not support caching images for Binder where dependencies are defined in binder/Dockerfile
(if you are defining your dependencies this way, you probably don't need this Action).
When this parameter is supplied, this Action will add/override binder/Dockerfile
in the branch checked out in the Actions runner:
### DO NOT EDIT THIS FILE! This Is Automatically Generated And Will Be Overwritten ###
FROM <IMAGE_NAME>
COMMIT_MSG
:The commit message associated with specifying the BINDER_CACHE
flag. If no value is specified, the default commit message of Update image tag
will be entered.MYBINDERORG_TAG
:This the Git branch, tag, or commit that you want mybinder.org to proactively build from your repo. This is useful if you wish to reduce startup time on mybinder.org. Your repository must be public for this work, as mybinder.org only works with public repositories.PUBLIC_REGISTRY_CHECK
:Setting this variable to any value will validate that the image pushed to the registry is publicly visible.IMAGE_SHA_NAME
The name of the docker image, which is tagged with the SHA.PUSH_STATUS
:This is false
if NO_PUSH
is provided or true
otherwhise.A very popular use case for this Action is to cache builds for mybinder.org. If you desire to cache builds for mybinder.org, you must specify the argument MYBINDERORG_TAG
. Some examples of doing this are below:
Proactively build your environment on mybinder.org for any branch. Alternatively, you can use using GitHub Actions to build an image for BindHub generally, including mybinder.org.
name: Binder
on: [push]
jobs:
Create-MyBinderOrg-Cache:
runs-on: ubuntu-latest
steps:
- name: cache binder build on mybinder.org
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: true
MYBINDERORG_TAG: ${{ github.event.ref }} # This builds the container on mybinder.org with the branch that was pushed on.
Same example as above, but also comment on a PR with a link to the binder environment. Commenting on the PR is optional, and is included here for informational purposes only. In this example the image will only be cached when the pull request is opened but not if the pull request is updated with subsequent commits.
In this example the image will only be cached when the pull request is opened but not if the pull request is updated with subsequent commits.
name: Binder
on:
pull_request:
types: [opened, reopened]
jobs:
Create-Binder-Badge:
runs-on: ubuntu-latest
steps:
- name: cache binder build on mybinder.org
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: true
MYBINDERORG_TAG: ${{ github.event.pull_request.head.ref }}
- name: comment on PR with Binder link
uses: actions/github-script@v1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var BRANCH_NAME = process.env.BRANCH_NAME;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${context.repo.owner}/${context.repo.repo}/${BRANCH_NAME}) �� Launch a binder notebook on this branch`
})
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
Instead of forcing mybinder.org to cache your builds, you can optionally build a Docker image with GitHub Actions and push that to a Docker registry, so that any BinderHub instance, including mybinder.org only has to pull the image. This might give you more control than triggering a build directly on mybinder.org like the method illustrated above. In this example, you must supply the secrets DOCKER_USERNAME
and DOCKER_PASSWORD
so that Actions can push to DockerHub. Note that, instead of your actual password, you can use an access token — which may be a more secure option.
In this case, we set BINDER_CACHE
to true
to enable this option. See the documentation for the parameter BINDER_CACHE
in the Optional Inputs section for more information.
name: Test
on: push
jobs:
binder:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BINDER_CACHE: true
PUBLIC_REGISTRY_CHECK: true
We recommend creating a personal access tokenand use that as DOCKER_PASSWORD
instead of using your dockerhub password.
name: Build Notebook Container
on: [push] # You may want to trigger this Action on other things than a push.
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DockerHub now has some pretty strong rate limits,so you might want to push to a different docker repository.quay.io is a popular place, and isn't tiedto any particular cloud vendor.
Login to quay.io
Create a new repository. This will determinethe name of your image, and you will push / pull from it. Your imagename will be quay.io/<username>/<repository-name>
.
Go to your account settings (under your name in the top right), andselect the 'Robot Accounts' option on the left menu.
Click 'Create Robot account', give it a memorable name (such as<hub-name>_image_builder
) and click 'Create'
In the next screen, select the repository you just created in step (2),and give the robot account Write
permission to the repository.
Once done, click the name of the robot account again. This will give youits username and password.
Create these GitHub secretsfor your repository with the credentials from the robot account:
QUAY_USERNAME
: user name of the robot accountQUAY_PASSWORD
: password of the robot accountUse the following config for your github action.
name: Build container image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with: # make sure username & password/token matches your registry
DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
DOCKER_REGISTRY: "quay.io"
IMAGE_NAME: "<quay-username>/<repository-name>"
Login to Amazon AWS Console
Create an individual IAM user who's access key will be used by the GitHub Actions. Make sure the user has permissions to make calls to the Amazon ECR APIs and to push/pull images to the repositories you need.Checkout and follow Amazon IAM best practices for the AWS credentials used in GitHub Actions workflows.
Create a new private repository. This will determine the name of your image, and you will push / pull from it. Your image name will be <aws-account-id>.dkr.ecr.<aws-region>.amazonaws.com/<username>/<repository-name>
.
Go to the IAM dashboard, 'Users' section and click on the username created at Step 2
.Click on 'Security credentials' tab, right below the 'Summary' section. In the 'Access keys' section, click on the 'Create access key' button.Once done, it will give you an 'Access key ID' and the 'Secret access key'.
Create these GitHub secretsfor your repository with the credentials from the robot account:
AWS_ACCESS_KEY_ID
: access key id of the IAM userAWS_SECRET_ACCESS_KEY
: secret access key of the IAM userUse the following config for your github action.
name: Build container image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: <region>
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_NAME: "<aws-username>/<repository-name>"
Login to Google Cloud Console
Create (or use an existing) Google Cloud Project with the billing activated. This will be the place where the registry hosting the repo2docker image will live.
Make sure Container Registry API
is enabled for this project.
The repository will be created automatically once the first image is pushed. Your image name will be grc.io/<gcp-project-id>/<repository-name>
.
Create a Service Account to authenticate the calls made by GitHub Actions to our GCP project:
Create Service Account
<hub-name>_image_builder
).Cloud Run Admin
, Service Account User
, and Storage Admin
.Click on the service account's name you just created and select the Keys
tab. Click on the ADD KEY
button, select Create new key
, then create a JSON key type. The private key will be saved to your computer. Make sure to store it somewhere secure!
Create these GitHub secretsfor your repository with the credentials from the robot account:
GCP_SA_KEY
: the private key of the service account created in the previous stepGCP_PROJECT_ID
: the id of the Google Cloud ProjectUse the following config for your github action.
name: Build container image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: Login to GCR
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCP_SA_KEY }}
- name: Update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_REGISTRY: gcr.io
IMAGE_NAME: ${{ secrets.GCP_PROJECT_ID }}/<repository-name>
Login to Google Cloud Console
Create (or use an existing) Google Cloud Project with the billing activated. This will be the place where the registry hosting the repo2docker image will live.
Make sure Artifact Registry API
is enabled for this project.
Create a new artifact repository. This will determine the name and location of your image. Your image name will be <location>-docker.pkg.dev/<gcp-project-id>/<repository-name>
Create a Service Account to authenticate the calls made by GitHub Actions to our GCP project:
Create Service Account
<hub-name>_image_builder
).Cloud Run Admin
, Service Account User
, Storage Admin
, Artifact Registry Repository Administrator
.Click on the service account's name you just created and select the Keys
tab. Click on the ADD KEY
button, select Create new key
, then create a JSON key type. The private key will be saved to your computer. Make sure to store it somewhere secure!
Create these GitHub secretsfor your repository with the credentials from the robot account:
GCP_SA_KEY
: the private key of the service account created in the previous stepGCP_PROJECT_ID
: the id of the Google Cloud ProjectUse the following config for your github action.
name: Build container image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: Login to GAR
uses: docker/login-action@v1
with:
registry: <location>-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_SA_KEY }}
- name: Update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_REGISTRY: <location>-docker.pkg.dev
IMAGE_NAME: ${{ secrets.GCP_PROJECT_ID }}/<repository-name>
Login to Azure Portal
Create a new container registry. This will determine the name of your image, and you will push / pull from it. Your image name will be <container-registry-name>.azurecr.io/<repository-name>
.
Go to Access Keys
option on the left menu.
Enable Admin user
so you can use the registry name as username and admin user access key as password to docker login to your container registry.
Create these GitHub secretsfor your repository with the credentials from the robot account:
ACR_USERNAME
: the registry nameACR_PASSWORD
: the access key of the admin userUse the following config for your github action.
name: Build container image
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: Update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_USERNAME: ${{ secrets.ACR_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.ACR_PASSWORD }}
DOCKER_REGISTRY: <container-registry-name>.azurecr.io
IMAGE_NAME: <repository-name>
If the docker registry accepts a credentials to be passed as a username and password string, you can do it like this.
name: Build Notebook Container
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with: # make sure username & password/token matches your registry
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_REGISTRY: "gcr.io"
If the docker registry doesn't credentials to be passed as a username and password strong, or if you want to do it in another way, you can configure credentials to the docker registry ahead of time instead. Below is an incomplete example doing that.
name: Build Notebook Container
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
# TODO: add a step here to setup credentials to push to your
# docker registry before running the repo2docker-action
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_REGISTRY: your-registry.example.org
IMAGE_NAME: your-image-name
When you do not provide an image name your image name defaults to DOCKER_USERNAME/GITHUB_REPOSITORY_NAME
. For example if the user hamelsmu
tried to run this Action from this repo, it would be named hamelsmu/repo2docker-action
. However, sometimes you may want a different image name, you can accomplish by providing the IMAGE_NAME
parameter as illustrated below:
name: Build Notebook Container
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_NAME: "hamelsmu/my-awesome-image" # this overrides the image name
You might want to only test the image build withtout pushing to a registry, for example to test a pull request. You can do this by specifying any value for the NO_PUSH
parameter:
name: Build Notebook Container
on: [pull_request]
jobs:
build-image-without-pushing:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: test build
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: 'true'
IMAGE_NAME: "hamelsmu/repo2docker-test"
When you specify a value for the NO_PUSH
parameter, you can omit the otherwhise mandatory parameters DOCKER_USERNAME
and DOCKER_PASSWORD
.
See the Contributing Guide.
# 添加源 yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo # 安装docker yum install -y docker-ce systemctl start docker systemctl enable docker # 安装doc
一、查看系统内核 Docker要求CentOS系统的内核版本高于 3.10 uname -r 3.10.0-1160.11.1.el7.x86_64 二、查看系统版本信息 cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRE
ubuntu 1804 #!/bin/bash #Description: Install docker on Ubuntu1804 #Version:1.0 #Date:2020-01-22 COLOR="echo -e \\033[1;31m" END="\033[m" DOCKER_VERSION="5:19.03.5~3-0~ubuntu-bionic" install_docker(){
master+ansible 192.168.2.72 # 使用pod 4核4G 20Gi node1 192.168.2.73 # 使用pod 2核2G 20Gi node2 192.168.2.94 # 使用pod 2核2G 20Gi nfs
1 - 检查当前版本 [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@localhost ~]# [root@localhost ~]# cat
删除docker yum remove docker docker-client docker-client-latest docker-common docker-lastest docker-lastest-logrotate docker-logrotate docker-selinux docker-engin-selinux docker-engine 1.sudo yum instal
卸载删除干净 $ sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docke
jupyter-repo2docker 将存储库源(例如 GitHub 存储库)作为输入。然后,它构建,运行和/或推送从该源构建的 Docker 镜像。 先决条件 Docker 用于构建和运行存储库,推荐使用社区版。 Python 3.4+。
问题内容: 我在我的App中有不同之处,在所有这些方面,我都不需要。我找不到如何禁用它。我试图找到一个属性将其应用于,但到目前为止我什么都没找到。有人可以帮我吗? 问题答案: 哈哈,我刚才也被困在这一点上,所以很高兴我可以为您提供解决方案,至少对我有用:) 您想要做的是在values / styles.xml中定义一个新样式,如下所示 只有NoActionBar样式对您来说才有意义。最后,您必须在
问题内容: 在我们的代码中,我们使用如下所示的getPhoto方法: 和onActivityResult: 有时,当我按“确定”时,不会被调用(未写)。我的代码有什么问题? 编辑: 未调用时出现在代码中。 问题答案: 您的活动是否有可能被杀死,这就是onActivityResult未被执行的原因?当相机的Intent返回时,通常将执行onActivityResult和onResume。在您的onP
问题内容: 对于以下任务,我需要您的建议和指导。 我有一个包含两个JComboBox的框架,假设它们分别命名为combo1和combo2,一个JTable和其他组件。 在初始阶段,当上述组件可见框架时。combo1组合框填充了一些值,但在初始阶段未选择任何值,combo2组合框被禁用并且表为空。 我在combo1和combo2上添加了一个actionListener。combo1中有两种类型的值,
问题内容: 我正在使用MVC创建一个基本的计算器。到目前为止,我正在改编一个教程,该教程仅将两个用户输入的值加在一起。 目前,我要添加到视图中的每个按钮都有其自己的侦听器,可以。但是,根据教程的控制器每个按钮只有一个ActionListener内部类。这重复了大量代码。 如何为所有按下的按钮创建一个ActionListener类,并在按下的按钮的ID上使用case语句? 在视图中注册oneButt
问题内容: 如果我没记错的话,Android准则说您应该将ActionBar用于应用程序内的全局导航。 但是同时,您通常希望定位最古老的API,以实现最大的兼容性。 我正在开始开发应用程序,并将目标设置为Android 2.2。 是否可以在此处使用操作栏?如果没有,我该怎么用? 谢谢凯文 问题答案: 使用ActionBarSherlock。 确保您的项目使用Android 4.0+作为构建目标,并