Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ on:
push:

jobs:
engine:
mono:
runs-on: ubuntu-latest
if: github.repository_owner == 'genedna'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
Expand All @@ -30,6 +31,7 @@ jobs:
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry' }}
postgres:
runs-on: ubuntu-latest
if: github.repository_owner == 'genedna'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
Expand All @@ -54,6 +56,7 @@ jobs:
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry' }}
ui:
runs-on: ubuntu-latest
if: github.repository_owner == 'genedna'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
Expand All @@ -76,3 +79,53 @@ jobs:
# For pull requests, export results to the build cache.
# Otherwise, push to a registry.
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry' }}
aries:
runs-on: ubuntu-latest
if: github.repository_owner == 'genedna'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "${{ vars.DOCKER_USER }}/mono"
platforms: linux/amd64,linux/arm64
install: true
- name: Build and push
uses: docker/build-push-action@v6
with:
tags: "${{ vars.DOCKER_USER }}/mono:aries-engine-latest"
file: docker/aries-engine-dockerfile-hub
# For pull requests, export results to the build cache.
# Otherwise, push to a registry.
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry' }}
mega:
runs-on: ubuntu-latest
if: github.repository_owner == 'genedna'
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: "lab:latest"
driver: cloud
endpoint: "${{ vars.DOCKER_USER }}/mono"
platforms: linux/amd64,linux/arm64
install: true
- name: Build and push
uses: docker/build-push-action@v6
with:
tags: "${{ vars.DOCKER_USER }}/mono:mega-engine-latest"
file: docker/mega-engine-dockerfile-hub
# For pull requests, export results to the build cache.
# Otherwise, push to a registry.
outputs: ${{ github.event_name == 'pull_request' && 'type=cacheonly' || 'type=registry' }}
68 changes: 68 additions & 0 deletions docker/aries-engine-dockerfile-hub
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
FROM debian:bookworm-slim AS builder

WORKDIR /opt/mega

# build args, to specify the build type, release or debug
ARG BUILD_TYPE=release

# check arg value
RUN if [ "$BUILD_TYPE" != "release" ] && [ "$BUILD_TYPE" != "debug" ]; then \
echo "Invalid BUILD_TYPE: $BUILD_TYPE, must be release or debug"; \
exit 1; \
fi

# set mirror for apt
# RUN echo "deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free" > /etc/apt/sources.list && \
# echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list && \
# echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free" >> /etc/apt/sources.list

RUN apt-get update && apt-get install -y \
cmake \
clang \
build-essential \
nodejs \
npm \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
ca-certificates \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& . $HOME/.cargo/env

ENV PATH=/root/.cargo/bin:$PATH

# clone the source code, the context must be the root of the project
RUN git clone https://github.com/genedna/mega.git .

# build
RUN cargo clean
RUN git submodule deinit --all -f
RUN git submodule update --init --recursive
RUN if [ "$BUILD_TYPE" = "release" ]; then \
cargo build -p aries --release; \
else \
cargo build -p aries; \
fi

# final image
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y libssl-dev ca-certificates

ARG BUILD_TYPE=release

COPY --from=builder /opt/mega/target/$BUILD_TYPE/aries /usr/local/bin/aries
COPY --from=builder /opt/mega/docker/start-aries.sh /usr/local/bin/start-aries.sh
RUN chmod +x /usr/local/bin/start-aries.sh
RUN chmod +x /usr/local/bin/aries
COPY --from=builder /opt/mega/target/$BUILD_TYPE/libpipy.so /usr/local/lib/libpipy.so
# refresh shared library cache
RUN ldconfig

VOLUME /opt/mega

CMD ["bash", "-c", "/usr/local/bin/start-aries.sh"]
69 changes: 69 additions & 0 deletions docker/mega-engine-dockerfile-hub
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM debian:bookworm-slim AS builder

WORKDIR /opt/mega

# build args, to specify the build type, release or debug
ARG BUILD_TYPE=release

# check arg value
RUN if [ "$BUILD_TYPE" != "release" ] && [ "$BUILD_TYPE" != "debug" ]; then \
echo "Invalid BUILD_TYPE: $BUILD_TYPE, must be release or debug"; \
exit 1; \
fi

# set mirror for apt
# RUN echo "deb http://mirrors.ustc.edu.cn/debian bookworm main contrib non-free" > /etc/apt/sources.list && \
# echo "deb http://mirrors.ustc.edu.cn/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list && \
# echo "deb http://mirrors.ustc.edu.cn/debian bookworm-updates main contrib non-free" >> /etc/apt/sources.list

RUN apt-get update && apt-get install -y \
cmake \
clang \
build-essential \
nodejs \
npm \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
ca-certificates \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& . $HOME/.cargo/env

ENV PATH=/root/.cargo/bin:$PATH

# clone the source code, the context must be the root of the project
RUN git clone https://github.com/genedna/mega.git .


# build
RUN cargo clean
RUN git submodule deinit --all -f
RUN git submodule update --init --recursive
RUN if [ "$BUILD_TYPE" = "release" ]; then \
cargo build -p mega --release; \
else \
cargo build -p mega; \
fi

# final image
FROM debian:bookworm-slim

RUN apt-get update && apt-get install -y libssl-dev ca-certificates

ARG BUILD_TYPE=release

COPY --from=builder /opt/mega/target/$BUILD_TYPE/mega /usr/local/bin/mega
COPY --from=builder /opt/mega/docker/start-mega.sh /usr/local/bin/start-mega.sh
RUN chmod +x /usr/local/bin/start-mega.sh
RUN chmod +x /usr/local/bin/mega
COPY --from=builder /opt/mega/target/$BUILD_TYPE/libpipy.so /usr/local/lib/libpipy.so
# refresh shared library cache
RUN ldconfig

VOLUME /opt/mega

CMD ["bash", "-c", "/usr/local/bin/start-mega.sh"]