diff --git a/.github/workflows/build-push-deploy.yml b/.github/workflows/build-push-deploy.yml new file mode 100644 index 0000000..43a2444 --- /dev/null +++ b/.github/workflows/build-push-deploy.yml @@ -0,0 +1,69 @@ +on: + push: + branches: + - main* + tags: + - 'v*' + +name: Build and Publish Docker Image +jobs: + build-docker: + runs-on: ubuntu-latest + name: Build Docker Image + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: docker/setup-buildx-action@v2 + + - name: Define docker image meta data tags + id: meta + uses: docker/metadata-action@v4 + with: + images: | + mayalabs/maya + ghcr.io/mayalabs/maya + tags: | + # Tag "git short sha" on all git events + type=sha,prefix= + + # Tag "next" on git-push-to-main-branch events + type=raw,value=next,event=branch,enable={{is_default_branch}} + + # Tag "latest" on git-tag events + type=raw,value=latest,event=tag + + # Tag "$APP_VERSION" on git-push-to-branch events + type=raw,value=${{ env.APP_VERSION }},event=branch + + # Tag "tag ref" on git-tag events + type=ref,event=tag + +# - name: Login to Github container registry +# uses: docker/login-action@v2 +# with: +# registry: ghcr.io +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to Dockerhub container registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + GITHUB_SHA=${{ github.sha }} + GO_BUILD_FLAG=${{ env.GO_BUILD_FLAG }} + tags: ${{ steps.meta.outputs.tags }} + + - name: Set short git commit SHA + id: vars + run: | + calculatedSha=$(git rev-parse --short=7 ${{ github.sha }}) + echo "::set-output name=short_sha::$calculatedSha" diff --git a/.gitignore b/.gitignore index 1a6a259..37e5476 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.bin .idea proofs/ -docs/book/ \ No newline at end of file +target \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3cde5e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,49 @@ +# Container for building Go binary. +FROM golang:1.22.0-bookworm AS builder +# Install dependencies +RUN apt-get update && apt-get install -y build-essential git +# Prep and copy source +WORKDIR /app/maya +COPY . . +# Populate GO_BUILD_FLAG with a build arg to provide an optional go build flag. +ARG GO_BUILD_FLAG +ENV GO_BUILD_FLAG=${GO_BUILD_FLAG} +RUN echo "Building with GO_BUILD_FLAG='${GO_BUILD_FLAG}'" +# Build with Go module and Go build caches. +RUN \ + --mount=type=cache,target=/go/pkg \ + --mount=type=cache,target=/root/.cache/go-build \ + go build -o maya "${GO_BUILD_FLAG}" . +RUN echo "Built maya version=$(./maya --version)" + +# Copy final binary into light stage. +FROM debian:bookworm-slim +RUN apt-get update && apt-get install -y ca-certificates wget +ARG GITHUB_SHA=local +ENV GITHUB_SHA=${GITHUB_SHA} +COPY --from=builder /app/maya/maya /usr/local/bin/ +# Don't run container as root +ENV USER=maya +ENV UID=1000 +ENV GID=1000 +RUN addgroup --gid "$GID" "$USER" +RUN adduser \ + --disabled-password \ + --gecos "maya" \ + --home "/opt/$USER" \ + --ingroup "$USER" \ + --no-create-home \ + --uid "$UID" \ + "$USER" +RUN chown maya /usr/local/bin/maya +RUN chmod u+x /usr/local/bin/maya +WORKDIR "/opt/$USER" +USER maya +ENTRYPOINT ["/usr/local/bin/maya"] +CMD ["run"] +# Used by GitHub to associate container with repo. +LABEL org.opencontainers.image.source="https://github.com/obolnetwork/maya" +LABEL org.opencontainers.image.title="maya" +LABEL org.opencontainers.image.description="Proof of Stake Ethereum Distributed Validator Client" +LABEL org.opencontainers.image.licenses="GPL v3" +LABEL org.opencontainers.image.documentation="https://github.com/ObolNetwork/maya/tree/main/docs" diff --git a/book.toml b/book.toml index df2fe5d..d32c9fe 100644 --- a/book.toml +++ b/book.toml @@ -7,7 +7,6 @@ title = "Maya Docs" description = "A book on all things maya" [output.html] -theme = "book/theme" git-repository-url = "https://github.com/LabsMaya/maya-zk-benchmarks" default-theme = "ayu" no-section-label = true diff --git a/book/introduction.md b/book/introduction.md index 2a934f4..cd15c56 100644 --- a/book/introduction.md +++ b/book/introduction.md @@ -1,3 +1,7 @@ # Introduction [Maya Labs](https://mayalabs.tech/) is an R&D company that builds tools to ensure the authenticity of digital media content. + +[//]: # (![](./logo.png)) + + \ No newline at end of file diff --git a/book/logo.png b/book/logo.png new file mode 100644 index 0000000..91eed2a Binary files /dev/null and b/book/logo.png differ