/
Dockerfile
55 lines (40 loc) · 1.58 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
###############################################################
### STAGE 1: Build node binary pre-requisites ###
###############################################################
FROM golang:1.18-alpine AS builder
# Install minimum necessary dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers
RUN apk update && apk add --no-cache $PACKAGES
# Set working directory for the build
WORKDIR /go/src/github.com/cheqd/cheqd-node
# Add source files
COPY . .
# Make node binary
RUN make build
###############################################################
### STAGE 2: Build cheqd-node image ###
###############################################################
FROM alpine:3.17 AS runner
# Install pre-requisites
RUN apk update && apk add --no-cache bash ca-certificates
# Copy over binaries from the build-env
COPY --from=builder /go/src/github.com/cheqd/cheqd-node/build/cheqd-noded /bin/cheqd-noded
# Set user directory and details
ARG HOME_DIR="/home/cheqd"
ARG USER="cheqd"
ARG GROUP=${USER}
ARG UID=1000
ARG GID=${UID}
# Add cheqd user to use in the container
RUN addgroup --system ${GROUP} --gid ${GID} \
&& adduser ${USER} --uid ${UID} -G ${GROUP} --system --home ${HOME_DIR} --shell /bin/bash
# Set entrypoint script
COPY --chown=${USER}:${GROUP} docker/entrypoint.sh /bin/node-start
RUN chmod +rx /bin/node-start
# Set working directory & bash defaults
WORKDIR ${HOME_DIR}
USER ${USER}
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
EXPOSE 26656 26657 26660 1317 9090 9091
# Set plain vanilla default entrypoint/command
CMD [ "cheqd-noded" ]