Skip to content

Commit

Permalink
chore: update docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasbhat0 committed Aug 21, 2024
1 parent 89e3c5f commit 7e1b423
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 59 deletions.
54 changes: 53 additions & 1 deletion .goreleaser-cross.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,56 @@ archives:
files:
- none*
checksum:
name_template: "{{ .ProjectName }}d_v{{ .Version }}_cross_checksums.txt"
name_template: "{{ .ProjectName }}d_v{{ .Version }}_cross_checksums.txt"

dockers:
- use: buildx
goos: linux
goarch: arm64
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64v8{{else}}{{ .ShortCommit }}-arm64v8{{end}}'
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}d"
- "--label=org.opencontainers.image.description={{.ProjectName}}d"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version=v{{.Version}}"
- "--label=org.opencontainers.image.url=https://arkeo.network/"
- "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
- use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile.dev
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-arm64v8'
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}d"
- "--label=org.opencontainers.image.description={{.ProjectName}}d"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version=v{{.Version}}"
- "--label=org.opencontainers.image.url=https://arkeo.network/"
- "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
docker_manifests:
- name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}d:{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}'
create_flags:
- --insecure
push_flags:
- --insecure
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-amd64{{else}}{{ .ShortCommit }}-amd64{{end}}'
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-arm64v8{{else}}{{ .ShortCommit }}-arm64v8{{end}}'
- name_template: 'ghcr.io/arkeonetwork/{{ .ProjectName }}d-dev:{{if eq .Env.RELEASE "true" }}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}'
create_flags:
- --insecure
push_flags:
- --insecure
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-amd64'
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-arm64v8'
36 changes: 35 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,38 @@ archives:
files:
- none*
checksum:
name_template: '{{ .ProjectName }}d_v{{ .Version }}_checksums.txt'
name_template: '{{ .ProjectName }}d_v{{ .Version }}_checksums.txt'
dockers:
- use: buildx
goos: linux
goarch: amd64
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d:{{if eq .Env.RELEASE "true"}}v{{ .Version }}-amd64{{else}}{{ .ShortCommit }}-amd64{{end}}'
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}d"
- "--label=org.opencontainers.image.description={{.ProjectName}}d"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version=v{{.Version}}"
- "--label=org.opencontainers.image.url=https://arkeo.network/"
- "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
- use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile.dev
image_templates:
- 'ghcr.io/arkeonetwork/{{ .ProjectName }}d-dev:{{if eq .Env.RELEASE "true"}}v{{ .Version }}{{else}}{{ .ShortCommit }}{{end}}-amd64'
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}d"
- "--label=org.opencontainers.image.description={{.ProjectName}}d"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version=v{{.Version}}"
- "--label=org.opencontainers.image.url=https://arkeo.network/"
- "--label=org.opencontainers.image.source=https://github.com/arkeonetwork/arkeo"
- "--label=org.opencontainers.image.licenses=Apache-2.0"
63 changes: 8 additions & 55 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,15 @@
#
# Arkeo
#
FROM scratch

ARG GO_VERSION="1.21"
COPY ./arkeod /usr/bin/arkeod

#
# Build
#
FROM golang:${GO_VERSION} as builder
WORKDIR /root/.arkeo

ARG GIT_VERSION
ARG GIT_COMMIT
EXPOSE 1317

ENV GOBIN=/go/bin
ENV GOPATH=/go
ENV CGO_ENABLED=0
ENV GOOS=linux
EXPOSE 26656

RUN go install github.com/jackc/tern/v2@latest
EXPOSE 26657

# Download go dependencies
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
ENTRYPOINT [ "/usr/bin/arkeod" ]

# Copy the entire codebase and build the application
COPY . .
ARG TAG=testnet
RUN make install

#
# Main
#
FROM ubuntu:lunar

# hadolint ignore=DL3008,DL4006
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
jq curl htop vim ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
update-ca-certificates


# Copy the compiled binaries over.
COPY --from=builder /go/bin/sentinel /go/bin/arkeod /go/bin/indexer /go/bin/api /go/bin/tern /usr/bin/
COPY scripts /scripts

ARG TAG=testnet
ENV NET=$TAG


ENTRYPOINT ["scripts/genesis.sh"]

# default to fullnode
CMD ["arkeod", "start"]

# Health check to ensure the container is running properly
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \
CMD curl -f http://localhost:26657/status || exit 1
CMD [ "help" ]
17 changes: 17 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM alpine:3.18

COPY ./arkeod /usr/bin/arkeod

WORKDIR /root/.arkeo

RUN apk add --no-cache bash jq

EXPOSE 1317

EXPOSE 26656

EXPOSE 26657

ENTRYPOINT [ "/usr/bin/arkeod" ]

CMD [ "help" ]
18 changes: 16 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,20 @@ install-testnet:

# ------------------------------ Docker Build ------------------------------

docker-build: proto-gen
@docker build . --file Dockerfile -t ${IMAGE}:${TAG}
docker-build:
$(DOCKER) run \
--rm \
-e BUILD_TAG=$(TAG) \
-e RELEASE=$(RELEASE) \
-e GITHUB_TOKEN="$(GITHUB_TOKEN)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/github.com/arkeonetwork/arkeo \
-w /go/src/github.com/arkeonetwork/arkeo \
ghcr.io/goreleaser/goreleaser:$(GORELEASER_VERSION) \
--clean
--snapshot



localnet: docker-build
@docker run --rm -it -p 1317:1317 -p 26656:26656 -p 26657:26657 ${IMAGE}:${TAG}
Expand Down Expand Up @@ -246,6 +258,7 @@ release-dry-run-cross:
--rm \
-e CGO_ENABLED=1 \
-e BUILD_TAG=$(TAG) \
-e RELEASE=$(RELEASE)\
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
Expand All @@ -259,6 +272,7 @@ release-dry-run:
--rm \
-e CGO_ENABLED=1 \
-e BUILD_TAG=$(TAG) \
-e RELEASE=$(RELEASE)\
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:/go/src/$(PACKAGE_NAME) \
-v `pwd`/sysroot:/sysroot \
Expand Down
16 changes: 16 additions & 0 deletions docker-compose-localnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
version: "3"

services:
node:
image: ghcr.io/arkeonetwork/arkeod-dev:${TAG}
entrypoint:
- sh
- /opt/genesis.sh
ports:
- 9090:9090
- 26657:26657
- 26656:26656
volumes:
- ./scripts:/opt:z
working_dir: /opt

0 comments on commit 7e1b423

Please sign in to comment.