Skip to content

Commit

Permalink
Update the main dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
muzuke committed Sep 23, 2024
1 parent 8f07e2e commit 37aecd5
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
name: Build libcorerust
runs-on: ${{ matrix.os }}
container:
image: radixdlt/build-layers:rust-v1
image: radixdlt/build-layers:rust
options: --user root
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,4 @@ COPY docker/build_scripts/config_radixdlt.sh /opt/radixdlt/config_radixdlt.sh

# See https://docs.docker.com/engine/reference/builder/#entrypoint
ENTRYPOINT ["/opt/radixdlt/config_radixdlt.sh"]
CMD ["/opt/radixdlt/bin/core"]
CMD ["/opt/radixdlt/bin/core"]
50 changes: 50 additions & 0 deletions Dockerfile.v2
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM radixdlt/build-layers:java AS java-container

WORKDIR /radixdlt

# Copy the relevant files at the repo root
COPY \
build.gradle \
gradlew \
gradlew.bat \
settings.gradle \
sonar-project.properties \
gradle.properties \
licence-header.txt \
/radixdlt/
COPY ./gradle /radixdlt/gradle
COPY ./common /radixdlt/common
COPY ./core /radixdlt/core
COPY ./core-rust-bridge /radixdlt/core-rust-bridge
COPY ./cli-tools /radixdlt/cli-tools
COPY ./shell /radixdlt/shell
COPY ./keygen /radixdlt/keygen
# Need .git for tag versions - but this can probably be removed soon
COPY ./.git/* /radixdlt/.git/

RUN SKIP_NATIVE_RUST_BUILD=TRUE ./gradlew clean build -x test -Pci=true -PrustBinaryBuildType=release

RUN cd core/build/distributions && \
unzip -j *.zip && \
mkdir -p /artifacts && \
cp *.jar /artifacts && \
cp core /artifacts

FROM radixdlt/build-layers:rust AS rust-container

WORKDIR /app

COPY core-rust/ /app

RUN mkdir -p /artifacts && \
/root/.cargo/bin/cargo build --profile=release && \
cp target/release/libcorerust.so /artifacts/libcorerust.so

FROM radixdlt/build-layers:app AS main

# Copy in the application artifacts
COPY --from=java-container /artifacts/*.jar /opt/radixdlt/lib/
COPY --from=java-container /artifacts/core /opt/radixdlt/bin/core
COPY --from=rust-container /artifacts/libcorerust.so /usr/lib/jni/libcorerust.so

RUN chmod +x /opt/radixdlt/bin/core
8 changes: 0 additions & 8 deletions docker/dockerfiles/app.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,6 @@ ENV RADIXDLT_HOME=/home/radixdlt \
RADIXDLT_NETWORK_ID=240 \
RADIXDLT_NODE_KEY_CREATE_IF_MISSING=false

# Copy in the application artifacts
# The artifacts directory on the host must be populated with the required files.
COPY artifacts/*.jar /opt/radixdlt/lib/
COPY artifacts/core /opt/radixdlt/bin/core
COPY artifacts/libcorerust.so /usr/lib/jni/libcorerust.so

RUN chmod +x /opt/radixdlt/bin/core

# Create configuration automatically when starting
COPY docker/build_scripts/config_radixdlt.sh /opt/radixdlt/config_radixdlt.sh

Expand Down
22 changes: 1 addition & 21 deletions docker/dockerfiles/java.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ LABEL org.opencontainers.image.source="https://github.com/radixdlt/babylon-node"
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.description="Java + Debian 12 (OpenJDK)"

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

CMD ["/bin/bash"]

Expand Down Expand Up @@ -63,26 +63,6 @@ RUN apt-get update \
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"

RUN mkdir -p /radixdlt
# Copy the relevant files at the repo root
# I wish we could just avoid pulling in the rust here, but https://github.com/moby/moby/issues/15771
COPY \
build.gradle \
gradlew \
gradlew.bat \
settings.gradle \
sonar-project.properties \
gradle.properties \
licence-header.txt \
/radixdlt/
COPY ./gradle /radixdlt/gradle
COPY ./common /radixdlt/common
COPY ./core /radixdlt/core
COPY ./core-rust-bridge /radixdlt/core-rust-bridge
COPY ./cli-tools /radixdlt/cli-tools
COPY ./shell /radixdlt/shell
COPY ./keygen /radixdlt/keygen
# Need .git for tag versions - but this can probably be removed soon
COPY ./.git/* /radixdlt/.git/

WORKDIR /radixdlt

Expand Down

0 comments on commit 37aecd5

Please sign in to comment.