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 9b12a5c
Showing
4 changed files
with
172 additions
and
3 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,50 @@ | ||
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 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
|
||
- uses: abatilo/actions-poetry@v2 | ||
|
||
- name: Generate poetry.lock | ||
run: | | ||
wget https://github.com/jumpserver/jumpserver/raw/master/pyproject.toml | ||
poetry config virtualenvs.create false | ||
poetry source add --priority=default PyPI | ||
poetry lock --no-update | ||
- 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.cache | ||
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/jms_${{ matrix.component }}:cache | ||
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,92 @@ | ||
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 | ||
|
||
WORKDIR /opt/jumpserver | ||
|
||
ARG PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 | ||
|
||
ENV GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 | ||
|
||
RUN --mount=type=bind,source=poetry.lock,target=/opt/jumpserver/poetry.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=/opt/jumpserver/pyproject.toml \ | ||
set -ex \ | ||
&& python3 -m venv /opt/py3 \ | ||
&& pip install $(grep cryptography pyproject.toml | sed 's/ = /==/g' | sed 's/"//g') \ | ||
&& pip install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& . /opt/py3/bin/activate \ | ||
&& poetry install --only=main |