-
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.
Merge pull request #19 from LabsMaya/xenowits/docker
add docker
- Loading branch information
Showing
6 changed files
with
123 additions
and
2 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,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" |
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,4 +1,4 @@ | ||
*.bin | ||
.idea | ||
proofs/ | ||
docs/book/ | ||
target |
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,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" |
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 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,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)) | ||
|
||
<img src="./logo.png" width="300" height="300"> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.