Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create base and configurable image for nucleus #7

Merged
merged 2 commits into from
May 27, 2024
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
26 changes: 26 additions & 0 deletions .github/workflows/build-and-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,29 @@ jobs:

- name: Install
run: make install

container-build-and-push:
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV

- name: Calculate commit hash for merge commit
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Login to dockerhub
run: docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} docker.io

- name: Build and Push
run: |
docker build -t komodoofficial/nucleusd:"$COMMIT_HASH" -t komodoofficial/nucleusd:latest -f ./Dockerfile .
# Here we push two images. "latest" image gets overridden with each
# push and $COMMIT_HASH is a constant image so we can use a specific
# build in container environments if needed (usually for debugging purposes).
docker push komodoofficial/nucleusd:"$COMMIT_HASH"
docker push komodoofficial/nucleusd:latest
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Compilation
FROM docker.io/library/golang:1.21-alpine AS nucleus-builder
WORKDIR /src/src/nucleus
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN apk add --no-cache $PACKAGES
RUN CGO_ENABLED=0 make install

# Runtime
FROM docker.io/chainguard/static:latest
COPY --from=nucleus-builder /go/bin/nucleusd /usr/local/bin/
USER 0

ENTRYPOINT ["nucleusd", "start"]
Loading