Skip to content

Commit

Permalink
feat: add docker release
Browse files Browse the repository at this point in the history
  • Loading branch information
JeancarloBarrios committed Oct 18, 2023
1 parent 10378bb commit a9d4dda
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 44 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ name: Release
on:
push:
tags:
# SemVer regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
- "^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"
# SemVer regex taken from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Added option to start with a v for cases like v0.0.1
- '^v?(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?'

concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
Expand Down Expand Up @@ -40,4 +42,34 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMET_VERSION: ${{ env.COMET_VERSION }}
COMET_VERSION: ${{ env.COMET_VERSION }}

build_psuh_node_image:
name: Build and Push Docker Image to GHCR
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/sedaprotocol/node

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockers/seda-node.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

7 changes: 3 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ before:

builds:
- main: ./cmd/seda-chaind
id: "sedad"
binary: sedad
id: "seda-chaind"
binary: seda-chaind
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -tags=badgerdb ledger netgo
Expand Down Expand Up @@ -45,6 +45,5 @@ changelog:

dockers:
- image_templates:
- ghcr.io/sedaprotocol/seda-chain:{{.Version}}
- dockerfile: "gorelease.Dockerfile"
- ghcr.io/sedaprotocol/seda-chaind:{{.Version}}
- skip_push: false
40 changes: 5 additions & 35 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
FROM golang:1.21-alpine AS build-env

# Install minimum necessary dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev
RUN apk add --no-cache $PACKAGES


WORKDIR /go/src/github.com/sedaprotocol/seda-chain

# Optimized fetching of dependencies
COPY go.mod go.sum ./

RUN go mod download

# Copy and build the project
COPY . .

# Dockerfile Cross-Compilation Guide
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide
ARG TARGETOS TARGETARCH


RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build


FROM alpine:3

RUN apk add --no-cache curl make bash jq sed
COPY --from=build-env /go/src/github.com/cosmos/cosmos-sdk/build/seda-chaid /usr/bin/seda-chaind

EXPOSE 26656 26657 1317 9090

CMD ["seda-chaind", "start"]
STOPSIGNAL SIGTERM
WORKDIR /root
# This Dockerfile si for .gorelease purposesBuild: docker build -t seda-chaind .
# If you are looking for a Dockerfile to run a node, see dockers/seda-node.Dockerfile
FROM scratch
ENTRYPOINT ["/seda-chaind"]
COPY seda-chaind /
4 changes: 2 additions & 2 deletions dockers/goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM scratch
ENTRYPOINT ["/sedad"]
COPY sedad /
ENTRYPOINT ["/seda-chaind"]
COPY seda-chaind /
File renamed without changes.

0 comments on commit a9d4dda

Please sign in to comment.