Skip to content

Commit

Permalink
chore!: clean up tx sim docker usage (#3902)
Browse files Browse the repository at this point in the history
This PR tidies up our docker usage. Namely, it puts our two Dockerfiles
in the `docker` directory, and the txsim one separately in the
`docker/txsim` folder. It also cleans up the indirection with the flags
so our e2e tests can pass them directly.
  • Loading branch information
cmwaters authored Sep 25, 2024
1 parent 10711c5 commit 32fc690
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
packages: write
uses: celestiaorg/.github/.github/workflows/[email protected]
with:
dockerfile: Dockerfile
dockerfile: docker/Dockerfile
checkout_ref: ${{ github.event.inputs.ref }}
secrets: inherit

Expand All @@ -33,7 +33,7 @@ jobs:
packages: write
uses: celestiaorg/.github/.github/workflows/[email protected]
with:
dockerfile: docker/Dockerfile_txsim
dockerfile: docker/txsim/Dockerfile
packageName: txsim
checkout_ref: ${{ github.event.inputs.ref }}
secrets: inherit
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
# hadolint lints the Dockerfile
hadolint:
uses: celestiaorg/.github/.github/workflows/[email protected]
with:
dockerfile: "docker/Dockerfile"

yamllint:
runs-on: ubuntu-latest
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ proto-format:
## build-docker: Build the celestia-appd docker image from the current branch. Requires docker.
build-docker:
@echo "--> Building Docker image"
$(DOCKER) build -t celestiaorg/celestia-app -f Dockerfile .
$(DOCKER) build -t celestiaorg/celestia-app -f docker/Dockerfile .
.PHONY: build-docker

## build-ghcr-docker: Build the celestia-appd docker image from the last commit. Requires docker.
build-ghcr-docker:
@echo "--> Building Docker image"
$(DOCKER) build -t ghcr.io/celestiaorg/celestia-app:$(COMMIT) -f Dockerfile .
$(DOCKER) build -t ghcr.io/celestiaorg/celestia-app:$(COMMIT) -f docker/Dockerfile .
.PHONY: build-ghcr-docker

## publish-ghcr-docker: Publish the celestia-appd docker image. Requires docker.
Expand All @@ -106,7 +106,8 @@ lint:
@echo "--> Running markdownlint"
@markdownlint --config .markdownlint.yaml '**/*.md'
@echo "--> Running hadolint"
@hadolint Dockerfile
@hadolint docker/Dockerfile
@hadolint docker/txsim/Dockerfile
@echo "--> Running yamllint"
@yamllint --no-warnings . -c .yamllint.yml
.PHONY: lint
Expand Down Expand Up @@ -186,7 +187,7 @@ txsim-build:

## txsim-build-docker: Build the tx simulator Docker image. Requires Docker.
txsim-build-docker:
docker build -t ghcr.io/celestiaorg/txsim -f docker/Dockerfile_txsim .
docker build -t ghcr.io/celestiaorg/txsim -f docker/txsim/Dockerfile .
.PHONY: txsim-build-docker

## adr-gen: Download the ADR template from the celestiaorg/.github repo.
Expand Down
File renamed without changes.
93 changes: 0 additions & 93 deletions docker/txsim.sh

This file was deleted.

15 changes: 5 additions & 10 deletions docker/Dockerfile_txsim → docker/txsim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stage 1: generate celestia-appd binary
# Stage 1: generate txsim binary
FROM --platform=$BUILDPLATFORM docker.io/golang:1.22.6-alpine3.19 as builder

ARG TARGETOS
Expand All @@ -16,11 +16,10 @@ RUN apk update && apk add --no-cache \
musl-dev
COPY . /celestia-app
WORKDIR /celestia-app
# we need the celestia-appd build as we might want to create an account
# internally for txsimulation

RUN uname -a &&\
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make build && make txsim-build
make txsim-build

# Stage 2: create a minimal image with the binary
FROM docker.io/alpine:3.20
Expand All @@ -45,18 +44,14 @@ RUN apk update && apk add --no-cache \
-s /sbin/nologin \
-u ${UID}

# Copy in the celestia-appd binary
COPY --from=builder /celestia-app/build/celestia-appd /bin/celestia-appd
# Copy in the txsim binary
COPY --from=builder /celestia-app/build/txsim /bin/txsim

COPY --chown=${USER_NAME}:${USER_NAME} docker/txsim.sh /opt/entrypoint.sh
COPY --chown=${USER_NAME}:${USER_NAME} docker/txsim/entrypoint.sh /opt/entrypoint.sh

USER ${USER_NAME}

# Set the working directory to the home directory.
WORKDIR ${CELESTIA_HOME}

# grpc, rpc, api ports
EXPOSE 26657 1317 9090

ENTRYPOINT [ "/bin/bash", "/opt/entrypoint.sh" ]
File renamed without changes.
7 changes: 7 additions & 0 deletions docker/txsim/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Starting txsim with command:"
echo "/bin/txsim $@"
echo ""

exec /bin/txsim $@
13 changes: 6 additions & 7 deletions test/e2e/testnet/txsimNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ func CreateTxClient(
return nil, err
}
args := []string{
fmt.Sprintf("-k %d", 0),
fmt.Sprintf("-g %s", endpoint),
fmt.Sprintf("-t %ds", pollTime),
fmt.Sprintf("-b %d ", sequences),
fmt.Sprintf("-d %d ", seed),
fmt.Sprintf("-a %d ", blobsPerSeq),
fmt.Sprintf("-s %s ", blobRange),
fmt.Sprintf("-grpc-endpoint %s", endpoint),
fmt.Sprintf("-poll-time %ds", pollTime),
fmt.Sprintf("-seed %d ", seed),
fmt.Sprintf("-blob %d ", sequences),
fmt.Sprintf("-blob-amounts %d ", blobsPerSeq),
fmt.Sprintf("-blob-sizes %s ", blobRange),
}

if err := txIns.Build().SetArgs(args...); err != nil {
Expand Down

0 comments on commit 32fc690

Please sign in to comment.