forked from commune-ai/subspace
-
Notifications
You must be signed in to change notification settings - Fork 1
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
45ac58c
commit 19434a3
Showing
5 changed files
with
114 additions
and
47 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build and push Docker image | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
build-n-push: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- id: commit | ||
uses: prompt/actions-commit-hash@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Docker Login | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
build-args: | | ||
AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
SCCACHE_BUCKET=agicommies-subspace-cache | ||
SCCACHE_ENDPOINT=${{ vars.SCCACHE_ENDPOINT }} | ||
SCCACHE_REGION=auto | ||
push: true | ||
tags: ghcr.io/agicommies/subspace:${{ steps.commit.outputs.short }} |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,21 +1,51 @@ | ||
FROM rust:1.75-bookworm as build-env | ||
FROM debian:12-slim AS builder | ||
|
||
ARG AWS_ACCESS_KEY_ID | ||
ARG AWS_SECRET_ACCESS_KEY | ||
ARG SCCACHE_BUCKET | ||
ARG SCCACHE_ENDPOINT | ||
ENV SCCACHE_REGION=auto | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y clang protobuf-compiler | ||
WORKDIR /app | ||
COPY . /app | ||
RUN cargo build --release | ||
COPY . . | ||
|
||
# Dependencies using during the build stage. | ||
RUN apt update && apt install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
build-essential \ | ||
protobuf-compiler \ | ||
libclang-dev \ | ||
git | ||
|
||
ENV PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
# Installs rust with a minimal footprint and adds the WASM chain. | ||
RUN curl https://sh.rustup.rs -sSf | \ | ||
sh -s -- -y --profile=minimal --default-toolchain=nightly-2024-02-01 | ||
|
||
RUN if [ -n "$SCCACHE_BUCKET" ]; then \ | ||
curl https://github.com/mozilla/sccache/releases/download/v0.7.7/sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz \ | ||
-Lo sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz && \ | ||
tar -xzf sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz --strip-components=1 \ | ||
sccache-v0.7.7-x86_64-unknown-linux-musl/sccache && \ | ||
./sccache --start-server && \ | ||
export RUSTC_WRAPPER="/app/sccache"; \ | ||
fi && \ | ||
cargo build -p node-subspace --release --locked | ||
|
||
RUN if [ -n "$SCCACHE_BUCKET" ]; then \ | ||
./sccache --show-stats; \ | ||
fi | ||
|
||
# FROM gcr.io/distroless/cc | ||
FROM debian:bookworm-slim | ||
FROM debian:12-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y zlib1g && \ | ||
RUN apt update && apt install -y zlib1g && \ | ||
rm -rf /var/cache/apt/archives /var/lib/apt/lists/* | ||
|
||
COPY --from=build-env /app/target/release/node-subspace /usr/local/bin | ||
COPY --from=builder /app/target/release/node-subspace /usr/local/bin | ||
|
||
WORKDIR /subspace | ||
|
||
ENV RUST_BACKTRACE=1 | ||
CMD ["node-subspace"] |
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