我不知道如何在 Github Actions 中运行缓存的 Docker 映像。
我按照有关发布 Docker 映像的教程来实现缓存、构建 Docker 映像并将其推送到 DockerHub 的任务。
我需要构建、缓存和运行图像,图像发布是可选的。
我的目标是加快 CI 工作流程。
以下是 Github Actions 工作流程:
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of …Run Code Online (Sandbox Code Playgroud) 在运行 Ubuntu 20.04 的 WSL2 下,我尝试安装 virtualenv 并运行 pip pip install virtualenv,但该命令只是挂起,不打印任何内容。
我终止了它并按照此处python3 -v -m pip install virtualenv的建议再次运行它,它挂在网上:import 'keyring.backends.OS_X'
[...]
# /usr/lib/python3/dist-packages/keyring/backends/__pycache__/_OS_X_API.cpython-38.pyc matches /usr/lib/python3/dist-packages/keyring/backends/_OS_X_API.py
# code object from '/usr/lib/python3/dist-packages/keyring/backends/__pycache__/_OS_X_API.cpython-38.pyc'
# destroy keyring.backends._OS_X_API
import 'keyring.backends.OS_X' # <_frozen_importlib_external.SourceFileLoader object at 0x7fa66c4b4610>
Run Code Online (Sandbox Code Playgroud)
我尝试按照此处的python -m pip install some_package_you_want回答运行,但出现了同样的问题。
另外,我尝试按照此处的PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring建议导出环境变量,但不幸的是它也没有解决问题。
编辑:该python3 -v -m pip install virtualenv命令在挂起大约 5 分钟后最终成功。
编辑2:我认为问题在于 WSL2 太慢,如此处评论。最终,我安装了 virtualenv (venv),并sudo apt-get install python3-venv使用命令激活了虚拟环境python3 -v …