mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-09-07 07:12:52 +02:00
let's build a docker image
This commit is contained in:
parent
3f3e684811
commit
000f3d5a8c
3 changed files with 88 additions and 24 deletions
64
.github/workflows/central-controller.yaml
vendored
64
.github/workflows/central-controller.yaml
vendored
|
@ -39,3 +39,67 @@ jobs:
|
||||||
- name: SelfTest
|
- name: SelfTest
|
||||||
run: |
|
run: |
|
||||||
./build/zerotier-selftest
|
./build/zerotier-selftest
|
||||||
|
|
||||||
|
- name: GCP Auth
|
||||||
|
uses: google-github-actions/auth@v2
|
||||||
|
with:
|
||||||
|
credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
|
||||||
|
|
||||||
|
- name: Set up GCloud CLI
|
||||||
|
uses: google-github-actions/setup-gcloud@v2
|
||||||
|
|
||||||
|
- name: Docker Auth
|
||||||
|
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
|
||||||
|
|
||||||
|
- name: Get branch name and sanitize
|
||||||
|
id: branch
|
||||||
|
run: |
|
||||||
|
BRANCH_NAME="${GITHUB_REF##*/}"
|
||||||
|
SANITIZED_BRANCH="${BRANCH_NAME//\//-}"
|
||||||
|
echo "branch_name=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Get short git commit SHA
|
||||||
|
id: sha
|
||||||
|
run: |
|
||||||
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||||
|
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and push Docker Image
|
||||||
|
run: |
|
||||||
|
docker build -t us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }} -f ext/central-controller-docker/Dockerfile.conda .
|
||||||
|
docker push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }}
|
||||||
|
|
||||||
|
multi-arch-docker:
|
||||||
|
runs-on: gha-runner-x64
|
||||||
|
needs: central_controller
|
||||||
|
steps:
|
||||||
|
- name: GCP Auth
|
||||||
|
uses: google-github-actions/auth@v2
|
||||||
|
with:
|
||||||
|
credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
|
||||||
|
|
||||||
|
- name: Set up GCloud CLI
|
||||||
|
uses: google-github-actions/setup-gcloud@v2
|
||||||
|
|
||||||
|
- name: Docker Auth
|
||||||
|
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
|
||||||
|
|
||||||
|
- name: Get branch name and sanitize
|
||||||
|
id: branch
|
||||||
|
run: |
|
||||||
|
BRANCH_NAME="${GITHUB_REF##*/}"
|
||||||
|
SANITIZED_BRANCH="${BRANCH_NAME//\//-}"
|
||||||
|
echo "branch_name=$SANITIZED_BRANCH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Get short git commit SHA
|
||||||
|
id: sha
|
||||||
|
run: |
|
||||||
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||||
|
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create and push multi-arch manifest
|
||||||
|
run: |
|
||||||
|
docker manifest create us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }} \
|
||||||
|
--amend us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-x64 \
|
||||||
|
--amend us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-ARM64
|
||||||
|
docker manifest push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/central-controller:${{ steps.sha.outputs.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}
|
||||||
|
|
23
ext/central-controller-docker/Dockerfile.conda
Normal file
23
ext/central-controller-docker/Dockerfile.conda
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
FROM golang:bookworm AS go_base
|
||||||
|
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
|
||||||
|
|
||||||
|
|
||||||
|
FROM continuumio/miniconda3:25.3.1-1
|
||||||
|
|
||||||
|
LABEL maintainer="ZeroTier Inc."
|
||||||
|
|
||||||
|
ADD environment.yml /tmp/environment.yml
|
||||||
|
|
||||||
|
RUN conda env create -f /tmp/environment.yml && \
|
||||||
|
conda clean -a -y
|
||||||
|
|
||||||
|
COPY --from=go_base /go/bin/migrate /usr/local/bin/migrate
|
||||||
|
COPY ext/central-controller-docker/migrations /migrations
|
||||||
|
ADD build/zerotier-one /usr/local/bin/zerotier-one
|
||||||
|
RUN chmod a+x /usr/local/bin/zerotier-one
|
||||||
|
# RUN echo "/usr/local/lib64" > /etc/ld.so.conf.d/usr-local-lib64.conf && ldconfig
|
||||||
|
|
||||||
|
ADD ext/central-controller-docker/main.sh /
|
||||||
|
RUN chmod a+x /main.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/main.sh"]
|
|
@ -1,23 +0,0 @@
|
||||||
FROM continuumio/miniconda3:25.3.1-1
|
|
||||||
|
|
||||||
LABEL maintainer="ZeroTier Inc."
|
|
||||||
|
|
||||||
RUN conda config --set channel_priority strict && \
|
|
||||||
conda install -y -c conda-forge \
|
|
||||||
conda-forge::cmake=3.25.1 \
|
|
||||||
conda-forge::git \
|
|
||||||
conda-forge::cxx-compiler \
|
|
||||||
conda-forge::c-compiler \
|
|
||||||
conda-forge::make \
|
|
||||||
conda-forge::pkg-config \
|
|
||||||
conda-forge::libpqxx=7.7.3 \
|
|
||||||
conda-forge::libopentelemetry-cpp=1.21.0 \
|
|
||||||
conda-forge::libopentelemetry-cpp-headers=1.21.0 \
|
|
||||||
conda-forge::google-cloud-cpp=2.39.0 \
|
|
||||||
conda-forge::libgoogle-cloud=2.39.0 \
|
|
||||||
conda-forge::rust=1.89.0 \
|
|
||||||
conda-forge::inja=3.3.0 \
|
|
||||||
conda-forge::libhiredis=1.3.0 \
|
|
||||||
conda-forge::nlohmann_json=3.12.0
|
|
||||||
|
|
||||||
# ADD . /src
|
|
Loading…
Add table
Reference in a new issue