Skip to content

Commit

Permalink
perf: docker push
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuler committed Jul 18, 2024
1 parent a770a0a commit 0a17216
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Push Base Image

on:
push:
paths:
- 'requirements.txt'
- '*.yml'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract date
id: vars
run: echo "IMAGE_TAG=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV

- name: Extract repository name
id: repo
run: echo "REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV

- name: Build and push multi-arch image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: jumpserver/${{ env.REPO }}:${{ env.IMAGE_TAG }}
file: Dockerfile

- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Get current branch name
id: get_branch
run: echo "current_branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV

- name: Update docker-web dependencies applets
run: |
git clone https://github.com/jumpserver/docker-web.git
cd docker-web
git checkout -b ${{ env.current_branch }}
sed -i 's|jumpserver/applets:.* |jumpserver/applets:${{ env.IMAGE_TAG }} |' Dockerfile
git add Dockerfile
git commit -m "perf: Update Dockerfile applets version"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ARG DEPENDENCIES=" \
wget \
zip"

ARG APT_MIRROR=http://mirrors.ustc.edu.cn
ARG APT_MIRROR=http://deb.debian.org
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -ex \
Expand All @@ -16,6 +16,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list \
&& apt-get update \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& apt-get clean all \
&& echo "no" | dpkg-reconfigure dash

WORKDIR /opt/applets
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pywinauto==0.6.6
selenium==4.4.0
pywin32==304
PyYAML==6.0
cffi==1.16.0
cffi==1.16.0

0 comments on commit 0a17216

Please sign in to comment.