Skip to content

Commit

Permalink
chore: add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
rach-id committed Jun 27, 2024
1 parent 7848161 commit fc54d51
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# stage 1 Build blobstream-ops binary
FROM --platform=$BUILDPLATFORM docker.io/golang:1.21.6-alpine3.18 as builder

ARG TARGETOS
ARG TARGETARCH

ENV CGO_ENABLED=0
ENV GO111MODULE=on

RUN apk update && apk --no-cache add make gcc musl-dev git bash

COPY . /blobstream-ops
WORKDIR /blobstream-ops
RUN uname -a &&\
CGO_ENABLED=${CGO_ENABLED} GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
make build

# final image
FROM docker.io/alpine:3.20.1

ARG UID=10001
ARG USER_NAME=celestia

ENV CELESTIA_HOME=/home/${USER_NAME}

# hadolint ignore=DL3018
RUN apk update && apk add --no-cache \
bash \
curl \
jq \
# Creates a user with $UID and $GID=$UID
&& adduser ${USER_NAME} \
-D \
-g ${USER_NAME} \
-h ${CELESTIA_HOME} \
-s /sbin/nologin \
-u ${UID}

COPY --from=builder /blobstream-ops/build/blobstream-ops /bin/blobstream-ops
COPY --chown=${USER_NAME}:${USER_NAME} docker/entrypoint.sh /opt/entrypoint.sh

USER ${USER_NAME}

# p2p port
EXPOSE 30000

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

set -e

echo "Starting Celestia Blobstream-ops with command:"
echo "$@"
echo ""

exec "$@"

0 comments on commit fc54d51

Please sign in to comment.