Skip to content

Commit

Permalink
Add GHA for Docker (#355)
Browse files Browse the repository at this point in the history
* docker gha

Signed-off-by: Jordan Rash <[email protected]>
  • Loading branch information
jordan-rash authored Aug 15, 2024
1 parent ddcf449 commit 9a1d5ec
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Docker Image Release

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: |
synadia/nex:main
synadia/nex:${{ env.SHORT_SHA }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
context: .
target: ci
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: |
synadia/nex:main_ci
synadia/nex:${{ env.SHORT_SHA }}_ci
2 changes: 1 addition & 1 deletion .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
cancel-in-progress: false

jobs:
release:
release_candidate:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
concurrency:
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ RUN go mod download
COPY . .
RUN go build -o nexagent ./agent/cmd/nex-agent

FROM debian:12-slim
FROM debian:12-slim AS nex
RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /
COPY --from=nexbuilder /nex/nexcli /usr/local/bin/nex
COPY --from=agentbuilder /agent/nexagent /usr/local/bin/nex-agent

FROM nex AS ci
COPY ./examples/nodeconfigs/simple.json nex.json
ENTRYPOINT ["nex", "node", "up", "--config", "nex.json"]

FROM nex
ENTRYPOINT ["nex"]

0 comments on commit 9a1d5ec

Please sign in to comment.