Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
# Build stage 0
FROM erlang:22
##
# Build stage
FROM --platform=linux/amd64 ubuntu:22.04 AS build

# Install some libs
RUN apt-get update -y && apt-get install -y \
libstdc++6 openssl libtinfo5
RUN apt-get update -yqq && \
apt-get install -yqq cmake clang libtool gcc git curl libssl-dev \
build-essential automake autoconf libncurses5-dev elixir iputils-ping \
erlang-base erlang-public-key erlang-asn1 erlang-ssl erlang-dev erlang-inets \
erlang-eunit erlang-common-test rebar3

# Set working directory
WORKDIR /opt/thepower

RUN mkdir -p /opt/thepower/db

# Copy Power_node application
COPY . .

# Set symlink
RUN ln -s /usr/bin/openssl /usr/local/bin/openssl
# Build binaries
RUN rebar3 compile
RUN rebar3 release
RUN rebar3 tar

RUN mkdir -p build

# TODO: Copy only necessary resources for runtime: bin lib releases
RUN cp -r bin build/

# Expose relevant ports
EXPOSE 49841
EXPOSE 29841
##
# Runtime stage: image for tpnode binary
FROM erlang:22.3.4-slim AS runtime

# Set working directory
WORKDIR /opt/thepower

ENTRYPOINT [ "./bin/thepower" ]
# Copy tpnode binaries and config: bin, lib and releases
COPY --from=build /opt/thepower/build/ .

CMD ["foreground"]
# TODO: confirm the behaviour of the binary to choose the accurate entrypoint
ENTRYPOINT ["./bin/thepower"]