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

Add official Dockerfile #17

Merged
merged 12 commits into from
Apr 10, 2024
46 changes: 46 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Use Ubuntu image for building for compatibility with macOS arm64 builds
FROM eclipse-temurin:21-jdk-jammy AS BUILD

# Set necessary args and environment variables for building phoenixd
ARG PHOENIXD_BRANCH=v0.1.3
ARG PHOENIXD_COMMIT_HASH=d805f81c2bfb8a09a726bb36278216e607100a16

# Upgrade all packages and install dependencies
RUN apt-get update \
&& apt-get upgrade -y
RUN apt-get install -y --no-install-recommends bash git \
&& apt clean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better apt cleanup:

Suggested change
&& apt clean
&& apt clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# Git pull phoenixd source at specified tag/branch and compile phoenixd
WORKDIR /phoenixd
RUN git clone --recursive --single-branch --branch ${PHOENIXD_BRANCH} -c advice.detachedHead=false \
https://github.com/ACINQ/phoenixd . \
&& test `git rev-parse HEAD` = ${PHOENIXD_COMMIT_HASH} || exit 1 \
&& ./gradlew distTar

# Alpine image to minimize final image size
FROM eclipse-temurin:21-jre-alpine as FINAL

# Upgrade all packages and install dependencies
RUN apk update \
&& apk upgrade --no-interactive
RUN apk add --update --no-cache bash

# Create a phoenix group and user
RUN addgroup -S phoenix -g 1000 \
&& adduser -S phoenix -G phoenix -u 1000 -h /phoenix
USER phoenix
pm47 marked this conversation as resolved.
Show resolved Hide resolved

# Unpack the release
WORKDIR /phoenix
COPY --chown=phoenix:phoenix --from=BUILD /phoenixd/build/distributions/phoenix-*-jvm.tar .
RUN tar --strip-components=1 -xvf phoenix-*-jvm.tar

# Indicate that the container listens on port 9740
EXPOSE 9740
pm47 marked this conversation as resolved.
Show resolved Hide resolved

# Expose default data directory as VOLUME
VOLUME [ "/phoenix/.phoenix" ]
pm47 marked this conversation as resolved.
Show resolved Hide resolved

# Run the daemon
ENTRYPOINT ["/phoenix/bin/phoenixd", "--agree-to-terms-of-service", "--http-bind-ip", "0.0.0.0"]