-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add dockerfile * add github workflow for node status agent --------- Co-authored-by: Fran Arbanas <[email protected]>
- Loading branch information
Showing
2 changed files
with
77 additions
and
4 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 |
---|---|---|
|
@@ -3,9 +3,54 @@ name: Build and upload Node Status agent container to harbor.nymte.ch | |
on: | ||
workflow_dispatch: | ||
|
||
env: | ||
WORKING_DIRECTORY: "nym-node-status-agent" | ||
CONTAINER_NAME: "node-status-agent" | ||
|
||
jobs: | ||
my-job: | ||
runs-on: arc-ubuntu-22.04 | ||
build-container: | ||
runs-on: arc-ubuntu-22.04-dind | ||
steps: | ||
- name: my-step | ||
run: echo "Hello World!" | ||
- name: Login to Harbor | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: harbor.nymte.ch | ||
username: ${{ secrets.HARBOR_ROBOT_USERNAME }} | ||
password: ${{ secrets.HARBOR_ROBOT_SECRET }} | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure git identity | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Lawrence Stalder" | ||
- name: Get version from cargo.toml | ||
uses: mikefarah/[email protected] | ||
id: get_version | ||
with: | ||
cmd: yq -oy '.package.version' ${{ env.WORKING_DIRECTORY }}/Cargo.toml | ||
|
||
- name: Check if tag exists | ||
run: | | ||
if git rev-parse ${{ steps.get_version.outputs.value }} >/dev/null 2>&1; then | ||
echo "Tag ${{ steps.get_version.outputs.value }} already exists" | ||
fi | ||
- name: Remove existing tag if exists | ||
run: | | ||
if git rev-parse ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} >/dev/null 2>&1; then | ||
git push --delete origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} | ||
git tag -d ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} | ||
fi | ||
- name: Create tag | ||
run: | | ||
git tag -a ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} -m "Version ${{ steps.get_version.outputs.result }}" | ||
git push origin ${{ env.WORKING_DIRECTORY }}-${{ steps.get_version.outputs.result }} | ||
- name: BuildAndPushImageOnHarbor | ||
run: | | ||
docker build -f ${{ env.WORKING_DIRECTORY }}/Dockerfile . -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:${{ steps.get_version.outputs.result }} -t harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }}:latest | ||
docker push harbor.nymte.ch/nym/${{ env.CONTAINER_NAME }} --all-tags |
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,28 @@ | ||
FROM rust:latest AS builder | ||
|
||
RUN apt update && apt install -yy libdbus-1-dev pkg-config libclang-dev | ||
|
||
# Install go | ||
RUN wget https://go.dev/dl/go1.22.5.linux-amd64.tar.gz -O go.tar.gz | ||
RUN tar -xzvf go.tar.gz -C /usr/local | ||
|
||
RUN git clone https://github.com/nymtech/nym-vpn-client /usr/src/nym-vpn-client | ||
ENV PATH=/go/bin:/usr/local/go/bin:$PATH | ||
WORKDIR /usr/src/nym-vpn-client/nym-vpn-core | ||
RUN cargo build --release --package nym-gateway-probe | ||
|
||
COPY ./ /usr/src/nym | ||
WORKDIR /usr/src/nym/nym-node-status-agent | ||
RUN cargo build --release | ||
|
||
FROM ubuntu:24.04 | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates | ||
|
||
WORKDIR /nym | ||
|
||
COPY --from=builder /usr/src/nym/target/release/nym-node-status-agent ./ | ||
COPY --from=builder /usr/src/nym-vpn-client/nym-vpn-core/target/release/nym-gateway-probe ./ | ||
|
||
ENV NODE_STATUS_AGENT_PROBE_PATH=/nym/nym-gateway-probe | ||
ENTRYPOINT [ "/nym/nym-node-status-agent" ] |