Skip to content

Commit 0ddfbf8

Browse files
committed
refactor: turn into monorepo
1 parent b84e275 commit 0ddfbf8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10949
-783
lines changed

.github/images/init/dockerfile.init

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM amazon/aws-cli
2+
RUN yum update -y && yum install -y tar gzip
3+
COPY docker/entrypoint.sh /entrypoint.sh
4+
ENTRYPOINT ["sh", "/entrypoint.sh"]

.github/images/init/entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
aws s3 cp "s3://$BUCKET/$KEY" "$DATA_DIR"
2+
tar -xzvf "$DATA_DIR/$KEY" -C "$DATA_DIR"

.github/images/operator/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM debian:12-slim
2+
3+
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
4+
5+
ARG TARGETARCH
6+
COPY bin/operator-Linux-${TARGETARCH} /bin/operator
7+
RUN chmod +x /bin/operator
8+
RUN ln -s /bin/operator /operator
9+
10+
ENTRYPOINT [ "operator" ]
File renamed without changes.

.github/images/rpc/dockerfile.hydra

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
ARG RUST_VERSION=1.81.0
2+
ARG BRANCH=main
3+
4+
FROM rust:${RUST_VERSION}-slim-bullseye AS build
5+
WORKDIR /app
6+
7+
RUN apt-get update && apt-get install -y libssl-dev pkg-config git ca-certificates
8+
RUN git clone https://github.com/cardano-scaling/hydra-control-plane.git
9+
RUN cd hydra-control-plane && git checkout ${BRANCH}
10+
11+
WORKDIR /app/hydra-control-plane
12+
RUN cargo build --locked --release
13+
RUN cp ./target/release/metrics-exporter /bin/metrics-exporter
14+
RUN cp ./target/release/open-head /bin/open-head
15+
RUN cp ./target/release/control-plane /bin/control-plane
16+
17+
FROM debian:bullseye-slim AS final
18+
RUN apt-get update && apt-get install -y ca-certificates curl
19+
WORKDIR /home/app
20+
21+
# Copy the executable from the "build" stage.
22+
COPY --from=build /bin/metrics-exporter /bin/metrics-exporter
23+
COPY --from=build /bin/open-head /bin/open-head
24+
COPY --from=build /bin/control-plane /bin/control-plane
25+
26+
# Configure rocket to listen on all interfaces.
27+
ENV ROCKET_ADDRESS=0.0.0.0
28+
ENV ROCKET_PORT=8000
29+
30+
# Expose the port that the application listens on.
31+
EXPOSE 8000
32+
33+
CMD ["/bin/metrics-exporter"]

.github/workflows/docker.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Docker
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
branches:
6+
- "main"
7+
paths:
8+
- ".github/image/Dockerfile"
9+
- ".github/workflows/docker.yml"
10+
- "src/**"
11+
12+
jobs:
13+
build:
14+
continue-on-error: true
15+
16+
strategy:
17+
matrix:
18+
include:
19+
- release_for: Linux-x86_64
20+
build_on: ubuntu-latest
21+
target: x86_64-unknown-linux-gnu
22+
args: "--locked --release"
23+
24+
- release_for: Linux-arm64
25+
build_on: buildjet-2vcpu-ubuntu-2204-arm
26+
target: "aarch64-unknown-linux-gnu"
27+
args: "--locked --release"
28+
29+
runs-on: ${{ matrix.build_on }}
30+
steps:
31+
- name: checkout repository
32+
uses: actions/checkout@v4
33+
34+
- uses: Swatinem/rust-cache@v2
35+
with:
36+
shared-key: "release"
37+
38+
- name: Install stable toolchain
39+
uses: actions-rs/toolchain@v1
40+
with:
41+
toolchain: stable
42+
43+
- name: Run cargo build
44+
uses: actions-rs/cargo@v1
45+
with:
46+
command: build
47+
args: --target ${{ matrix.target }} ${{ matrix.args }}
48+
49+
- name: rename binaries
50+
run: |
51+
mv target/${{ matrix.target }}/release/operator${{ matrix.ext }} operator-${{ matrix.release_for }}${{ matrix.ext }}
52+
53+
- name: upload artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: binaries-${{ matrix.release_for }}
57+
path: operator-${{ matrix.release_for }}${{ matrix.ext }}
58+
59+
docker:
60+
runs-on: ubuntu-latest
61+
needs: [build]
62+
63+
permissions:
64+
contents: read
65+
packages: write
66+
67+
steps:
68+
- name: Checkout repository
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Extract metadata (tags, labels) for Docker
75+
id: meta
76+
uses: docker/metadata-action@v5
77+
with:
78+
images: ghcr.io/cardano-scaling/doom-patrol-operator
79+
tags: |
80+
type=raw,value=latest,enable={{is_default_branch}}
81+
type=semver,pattern=v{{major}}
82+
type=semver,pattern=v{{major}}.{{minor}}
83+
type=semver,pattern=v{{version}}
84+
type=sha
85+
86+
- name: Login to DockerHub
87+
uses: docker/login-action@v3
88+
with:
89+
registry: ghcr.io/cardano-scaling
90+
username: ${{ github.actor }}
91+
password: ${{ secrets.GITHUB_TOKEN }}
92+
93+
- name: Download artifacts
94+
uses: actions/download-artifact@v4
95+
with:
96+
pattern: binaries-*
97+
merge-multiple: true
98+
path: .github/image/bin
99+
100+
# we need to rename the artifact so that the name matches
101+
# the value that Docker uses for TARGET_ARCH to keep the
102+
# Dockerfile simple
103+
- name: Rename artifacts
104+
run: |+
105+
mv .github/image/bin/operator-Linux-x86_64 .github/image/bin/operator-Linux-amd64
106+
107+
- name: Build and push
108+
uses: docker/build-push-action@v5
109+
with:
110+
context: .github/image
111+
platforms: linux/arm64,linux/amd64
112+
push: true
113+
tags: ${{ steps.meta.outputs.tags }}
114+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/hydra-control-plane.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/open-head.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ result*
44
.envrc
55
.direnv
66
# runtime
7-
protocol-parameters.json
87
utxo.json
98
*.vk
109
*.sk

0 commit comments

Comments
 (0)