-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
3,291 additions
and
5,713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build and Push Base Image | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'go.mod' | ||
- 'Dockerfile-base' | ||
- 'package.json' | ||
- 'yarn.lock' | ||
|
||
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 | ||
file: Dockerfile-base | ||
tags: jumpserver/${{ env.REPO }}-base:${{ env.IMAGE_TAG }} | ||
|
||
- name: Update Dockerfile | ||
run: | | ||
sed -i 's|-base:.* AS stage-build|-base:${{ env.IMAGE_TAG }} AS stage-build|' Dockerfile | ||
- name: Commit changes | ||
run: | | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git add Dockerfile | ||
git commit -m "perf: Update Dockerfile with new base image tag" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
FROM redis:6.2-bullseye AS redis-stage | ||
FROM golang:1.22-bullseye AS stage-go-build | ||
|
||
FROM node:20.15-bullseye | ||
COPY --from=stage-go-build /usr/local/go/ /usr/local/go/ | ||
COPY --from=stage-go-build /go/ /go/ | ||
COPY --from=redis-stage /usr/local/bin/redis-cli /usr/local/bin/redis-cli | ||
ENV GOPATH=/go | ||
ENV PATH=/go/bin:/usr/local/go/bin:$PATH | ||
ARG TARGETARCH | ||
ARG NPM_REGISTRY="https://registry.npmmirror.com" | ||
ENV NPM_REGISTY=$NPM_REGISTRY | ||
RUN set -ex \ | ||
&& echo "no" | dpkg-reconfigure dash | ||
RUN set -ex \ | ||
&& npm config set registry ${NPM_REGISTRY} \ | ||
&& yarn config set registry ${NPM_REGISTRY} | ||
|
||
WORKDIR /opt | ||
|
||
ARG HELM_VERSION=v3.14.3 | ||
ARG KUBECTL_VERSION=v1.29.3 | ||
ARG CHECK_VERSION=v1.0.3 | ||
ARG USQL_VERSION=v0.0.1 | ||
RUN set -ex \ | ||
&& mkdir -p /opt/koko/bin \ | ||
&& wget -O kubectl.tar.gz https://dl.k8s.io/${KUBECTL_VERSION}/kubernetes-client-linux-${TARGETARCH}.tar.gz \ | ||
&& tar -xf kubectl.tar.gz --strip-components=3 -C /opt/koko/bin/ kubernetes/client/bin/kubectl \ | ||
&& mv /opt/koko/bin/kubectl /opt/koko/bin/rawkubectl \ | ||
&& wget https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz \ | ||
&& tar -xf helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz --strip-components=1 -C /opt/koko/bin/ linux-${TARGETARCH}/helm \ | ||
&& mv /opt/koko/bin/helm /opt/koko/bin/rawhelm \ | ||
&& wget https://github.com/jumpserver-dev/healthcheck/releases/download/${CHECK_VERSION}/check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz \ | ||
&& tar -xf check-${CHECK_VERSION}-linux-${TARGETARCH}.tar.gz -C /opt/koko/bin/ \ | ||
&& wget https://github.com/jumpserver-dev/usql/releases/download/${USQL_VERSION}/usql-${USQL_VERSION}-linux-${TARGETARCH}.tar.gz \ | ||
&& tar -xf usql-${USQL_VERSION}-linux-${TARGETARCH}.tar.gz --strip-components=1 -C /opt/koko/bin/ \ | ||
&& wget -O /opt/koko/.kubectl_aliases https://github.com/ahmetb/kubectl-aliases/raw/master/.kubectl_aliases \ | ||
&& chmod 755 /opt/koko/bin/* \ | ||
&& chown root:root /opt/koko/bin/* \ | ||
&& rm -f *.tar.gz | ||
|
||
|
||
|
||
WORKDIR /opt/koko | ||
|
||
ARG MONGOSH_VERSION=2.2.12 | ||
RUN set -ex \ | ||
&& mkdir -p /opt/koko/lib \ | ||
&& \ | ||
case "${TARGETARCH}" in \ | ||
amd64) \ | ||
wget https://downloads.mongodb.com/compass/mongosh-${MONGOSH_VERSION}-linux-x64.tgz \ | ||
&& tar -xf mongosh-${MONGOSH_VERSION}-linux-x64.tgz \ | ||
&& chown root:root mongosh-${MONGOSH_VERSION}-linux-x64/bin/* \ | ||
&& mv mongosh-${MONGOSH_VERSION}-linux-x64/bin/mongosh /opt/koko/bin/ \ | ||
&& mv mongosh-${MONGOSH_VERSION}-linux-x64/bin/mongosh_crypt_v1.so /opt/koko/lib/ \ | ||
&& rm -rf mongosh-${MONGOSH_VERSION}-linux-x64* \ | ||
;; \ | ||
arm64|ppc64le|s390x) \ | ||
wget https://downloads.mongodb.com/compass/mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}.tgz \ | ||
&& tar -xf mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}.tgz \ | ||
&& chown root:root mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}/bin/* \ | ||
&& mv mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}/bin/mongosh /opt/koko/bin/ \ | ||
&& mv mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}/bin/mongosh_crypt_v1.so /opt/koko/lib/ \ | ||
&& rm -rf mongosh-${MONGOSH_VERSION}-linux-${TARGETARCH}* \ | ||
;; \ | ||
*) \ | ||
echo "Unsupported architecture: ${TARGETARCH}" \ | ||
;; \ | ||
esac | ||
|
||
WORKDIR /opt/koko/ui | ||
|
||
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=koko \ | ||
--mount=type=bind,source=ui/package.json,target=package.json \ | ||
--mount=type=bind,source=ui/yarn.lock,target=yarn.lock \ | ||
yarn install | ||
|
||
WORKDIR /opt/koko/ | ||
|
||
ENV CGO_ENABLED=0 | ||
ENV GO111MODULE=on | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.