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 repository official Dockerfile #415

Merged
merged 10 commits into from
May 19, 2022
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
with:
push: true
tags: ghcr.io/celestiaorg/celestia-app:latest
file: docker/Dockerfile
file: Dockerfile
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# stage 1 Generate celestia-appd Binary
FROM golang:1.17-alpine as builder
RUN apk update && apk --no-cache add make gcc git musl-dev
COPY . /celestia-app
WORKDIR /celestia-app
RUN make build

# stage 2
FROM alpine
RUN apk update && apk --no-cache add bash

COPY --from=builder /celestia-app/build/celestia-appd /bin/celestia-appd
COPY docker/entrypoint.sh /opt/entrypoint.sh

# p2p, rpc and prometheus port
EXPOSE 26656 26657 1317 9090

ENV CELESTIA_HOME /opt

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

# This script creates the necessary files before starting Celestia-appd

# only create the priv_validator_state.json if it doesn't exist and the command is start
if [[ $3 == "start" && ! -f $CELESTIA_HOME/data/priv_validator_state.json ]]
rach-id marked this conversation as resolved.
Show resolved Hide resolved
then
mkdir $CELESTIA_HOME/data # it is alright if it fails, the script will continue executing
cat <<EOF > $CELESTIA_HOME/data/priv_validator_state.json
{
"height": "0",
"round": 0,
"step": 0
}
EOF
fi

/bin/celestia-appd $@