Skip to content

Commit

Permalink
Webshell image supports arm64 now (caoyingjunz#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazytaxii authored Jan 28, 2024
1 parent 172e1df commit c127d1e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ jobs:
username: ${{ secrets.DOCKER_NAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build webshell image
# TODO: for saving time and resources, webshell image should not be built every time
- name: Build and push webshell image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64 # arm64 will be supported in the future
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_NAME }}/pixiu-webshell:latest
${{ secrets.DOCKER_NAME }}/pixiu-webshell:v0.1
${{ secrets.DOCKER_NAME }}/pixiu-webshell:${{ env.COMMIT_HASH }}
- name: Build and push the pixiu image
Expand All @@ -48,4 +50,5 @@ jobs:
push: true
tags: |
${{ secrets.DOCKER_NAME }}/pixiu:latest
${{ secrets.DOCKER_NAME }}/pixiu:v0.1
${{ secrets.DOCKER_NAME }}/pixiu:${{ env.COMMIT_HASH }}
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
tag = v0.1
releaseName = pixiu
dockerhubUser = jacky06
k8sVersion ?= v1.23.6
helmVersion ?= v3.7.1

ALL: run

Expand All @@ -19,7 +21,9 @@ push: image
docker push $(dockerhubUser)/$(releaseName):$(tag)

webshell-image:
docker build -t $(dockerhubUser)/pixiu-webshell:$(tag) -f docker/Dockerfile .
docker build --build-arg K8S_VERSION=$(k8sVersion) \
--build-arg HELM_VERSION=$(helmVersion) \
-t $(dockerhubUser)/pixiu-webshell:$(tag) -f docker/Dockerfile .

push-webshell-image: webshell-image
docker push $(dockerhubUser)/pixiu-webshell:$(tag)
Expand Down
17 changes: 11 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
# 使用 Ubuntu 作为基础镜像
FROM ubuntu:22.04

ARG K8S_VERSION
ARG HELM_VERSION

# 安装vim
RUN apt-get update && apt-get install -y vim

# 安装必要的软件包
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl bash-completion

# 安装 kubectl
RUN curl -LO "https://dl.k8s.io/release/v1.23.6/bin/linux/amd64/kubectl" && \
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \
curl -LO "https://dl.k8s.io/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm -rf kubectl

# 安装 helm
RUN curl -LO "https://get.helm.sh/helm-v3.7.1-linux-amd64.tar.gz" && \
tar -zxvf helm-v3.7.1-linux-amd64.tar.gz && \
rm -rf helm-v3.7.1-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/helm && \
rm -rf linux-amd64
RUN ARCH=$(uname -m|sed 's|x86_64|amd64|'|sed 's|aarch64|arm64|') && \
curl -LO "https://get.helm.sh/helm-${HELM_VERSION}-linux-${ARCH}.tar.gz" && \
tar -zxvf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \
rm -rf helm-${HELM_VERSION}-linux-${ARCH}.tar.gz && \
mv linux-${ARCH}/helm /usr/local/bin/helm && \
rm -rf linux-${ARCH}

# 配置 bash 补全和自定义的 PS1 提示符
RUN echo 'source /etc/profile.d/bash_completion.sh' >> /root/.bashrc \
Expand Down

0 comments on commit c127d1e

Please sign in to comment.