❄️ 使用 Github Action 自动构建 Docker 镜像
This commit is contained in:
parent
58f0627ab6
commit
d6aa0595b2
35
.github/workflows/docker.yml
vendored
Normal file
35
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: Docker Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- "README.md"
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Dockerhub login
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
with:
|
||||
buildx-version: latest
|
||||
- name: Build dockerfile (with push)
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
run: |
|
||||
docker buildx build \
|
||||
--platform=linux/amd64,linux/arm/v7,linux/arm64 \
|
||||
--output "type=image,push=true" \
|
||||
--file ./Dockerfile . \
|
||||
--tag mrwangzhe/pagermaid_modify:latest
|
@ -31,13 +31,12 @@ RUN pacman -Syu --needed --noconfirm \
|
||||
file \
|
||||
procps-ng
|
||||
RUN sed -e 's;^# \(%wheel.*NOPASSWD.*\);\1;g' -i /etc/sudoers
|
||||
RUN useradd pagermaid -u 3333 -r -m -d /pagermaid
|
||||
RUN useradd pagermaid -r -m -d /pagermaid
|
||||
RUN usermod -aG wheel,users pagermaid
|
||||
USER pagermaid
|
||||
RUN mkdir /pagermaid/workdir
|
||||
RUN git clone -b master https://github.com/xtaodada/PagerMaid-Modify.git /pagermaid/workdir
|
||||
WORKDIR /pagermaid/workdir
|
||||
RUN python3 -m virtualenv /pagermaid/venv
|
||||
RUN source /pagermaid/venv/bin/activate; pip3 install -r requirements.txt
|
||||
RUN python3 -m virtualenv venv
|
||||
RUN source venv/bin/activate; pip3 install -r requirements.txt
|
||||
CMD ["sh","utils/docker-run.sh"]
|
||||
CMD ["sh","utils/entrypoint.sh"]
|
||||
|
@ -55,16 +55,16 @@ access_check() {
|
||||
build_docker() {
|
||||
printf "请输入 PagerMaid 容器的名称:"
|
||||
read -r container_name <&1
|
||||
echo "正在构建 Docker 镜像 . . ."
|
||||
echo "正在拉取 Docker 镜像 . . ."
|
||||
docker rm -f "$container_name" > /dev/null 2>&1
|
||||
docker build - --force-rm --no-cache -t pagermaid_"$container_name" < Dockerfile.persistant
|
||||
docker pull pagermaid_modify
|
||||
}
|
||||
|
||||
start_docker() {
|
||||
echo "正在启动 Docker 容器 . . ."
|
||||
echo "在登录后,请按 Ctrl + C 使容器在后台模式下重新启动。"
|
||||
sleep 3
|
||||
docker run -it --restart=always --name="$container_name" --hostname="$container_name" pagermaid_"$container_name" <&1
|
||||
docker run -it --restart=always --name="$container_name" --hostname="$container_name" pagermaid_modify <&1
|
||||
echo ""
|
||||
echo "Docker 创建完毕。"
|
||||
echo ""
|
||||
|
Loading…
Reference in New Issue
Block a user