forked from jumpserver/Dockerfile
-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
6fa0e21
commit 1cd364e
Showing
4 changed files
with
164 additions
and
86 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
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,53 @@ | ||
name: Build Cache | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
build-cache: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
component: [core] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: docker/setup-qemu-action@v3 | ||
- uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Get Cryptography Version | ||
run: | | ||
wget https://github.com/jumpserver/jumpserver/raw/master/pyproject.toml | ||
cryptography_version=$(awk -F'"' '/cryptography/{print $2}' pyproject.toml) | ||
echo "cryptography_version=${cryptography_version}" >> $GITHUB_ENV | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ${{ matrix.component }}/Dockerfile.base | ||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x | ||
push: true | ||
build-args: | ||
CRYPTOGRAPHY_VERSION=${{ env.cryptography_version }} | ||
tags: | | ||
${{ github.repository_owner }}/${{ matrix.component }}:base-bookworm | ||
ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}:base-bookworm | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
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,85 @@ | ||
FROM python:3.11-slim-bookworm | ||
ARG TARGETARCH | ||
|
||
ARG BUILD_DEPENDENCIES=" \ | ||
g++ \ | ||
make \ | ||
pkg-config" | ||
|
||
ARG DEPENDENCIES=" \ | ||
freetds-dev \ | ||
libpq-dev \ | ||
libffi-dev \ | ||
libjpeg-dev \ | ||
libldap2-dev \ | ||
libsasl2-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
libxmlsec1-dev \ | ||
libxmlsec1-openssl \ | ||
freerdp2-dev \ | ||
libaio-dev" | ||
|
||
ARG TOOLS=" \ | ||
ca-certificates \ | ||
curl \ | ||
default-libmysqlclient-dev \ | ||
default-mysql-client \ | ||
git \ | ||
git-lfs \ | ||
unzip \ | ||
xz-utils \ | ||
wget" | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get -y install --no-install-recommends ${BUILD_DEPENDENCIES} \ | ||
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \ | ||
&& apt-get -y install --no-install-recommends ${TOOLS} \ | ||
&& echo "no" | dpkg-reconfigure dash \ | ||
&& apt-get clean all \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /opt | ||
|
||
ARG RUST_VERSION=1.71.1 | ||
RUN set -ex \ | ||
&& mkdir -p /opt/rust-install \ | ||
&& rustUrl="https://static.rust-lang.org/dist" \ | ||
&& \ | ||
case "${TARGETARCH}" in \ | ||
# amd64) rustArch='x86_64-unknown-linux-gnu'; \ | ||
# ;; \ | ||
# arm64) rustArch='aarch64-unknown-linux-gnu'; \ | ||
# ;; \ | ||
mips64le) rustArch='mips64el-unknown-linux-gnuabi64'; \ | ||
;; \ | ||
ppc64le) rustArch='powerpc64le-unknown-linux-gnu'; \ | ||
;; \ | ||
riscv64) rustArch='riscv64gc-unknown-linux-gnu'; \ | ||
;; \ | ||
s390x) rustArch='s390x-unknown-linux-gnu'; \ | ||
;; \ | ||
loong64) rustArch='loongarch64-unknown-linux-gnu'; \ | ||
rustUrl="https://download.jumpserver.org/rust/dist"; \ | ||
;; \ | ||
*) echo >&2 "error: unsupported architecture: ${TARGETARCH}"; \ | ||
;; \ | ||
esac \ | ||
&& \ | ||
if [ -n "${rustArch}" ]; then \ | ||
wget -O /opt/rust.tar.gz "${rustUrl}/rust-${RUST_VERSION}-${rustArch}.tar.xz"; \ | ||
tar -xf /opt/rust.tar.gz -C /opt/rust-install --strip-components=1; \ | ||
cd /opt/rust-install && ./install.sh; \ | ||
cd /opt && rm -rf /opt/rust-install /opt/rust.tar.gz; \ | ||
fi | ||
|
||
ARG CRYPTOGRAPHY_VERSION | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 | ||
|
||
RUN set -ex \ | ||
&& pip install cryptography==${CRYPTOGRAPHY_VERSION} \ | ||
&& pip install poetry |