Skip to content
Snippets Groups Projects
Commit f4bd8bde authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix(#125): review: revert Dockerfile changes + build on podman

parent 4bc600ce
No related branches found
No related tags found
No related merge requests found
Pipeline #33579 failed
......@@ -70,7 +70,7 @@ fmt_and_clippy:
- echo podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS .
- podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS .
tags:
- kepler
- podman
.docker_deploy:
stage: deploy
......
# Workaround for https://github.com/containers/buildah/issues/4742
FROM debian:bullseye-slim as target
#ARG TARGETPLATFORM
#RUN apt-get update
#RUN apt-get install ca-certificates curl gnupg
#RUN install -m 0755 -d /etc/apt/keyrings
#RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
#RUN chmod a+r /etc/apt/keyrings/docker.gpg
#RUN echo \
# "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
# "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
# tee /etc/apt/sources.list.d/docker.list > /dev/null
#
#RUN apt-get update
#RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
RUN docker run --entrypoint /bin/sh hello-world echo FromDocker
# ------------------------------------------------------------------------------
# Build Stage
# ------------------------------------------------------------------------------
# When building for a foreign arch, use cross-compilation
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
FROM --platform=$BUILDPLATFORM rust:1-bullseye as build
ARG BUILDPLATFORM
ARG TARGETPLATFORM
# We need the target arch triplet in both Debian and rust flavor
RUN echo "DEBIAN_ARCH_TRIPLET='$(dpkg-architecture -A${TARGETPLATFORM#linux/} -qDEB_TARGET_MULTIARCH)'" >>/root/dynenv
......@@ -38,34 +33,38 @@ RUN if [ "$debug" = 0 ]; then \
echo "TARGET_FOLDER=debug" >>/root/dynenv; \
fi
## Configure cross-build environment if need be
#RUN set -x && \
# if [ "$TARGETPLATFORM" != "$BUILDPLATFORM" ]; then \
# . /root/dynenv && \
# apt install -y gcc-$DEBIAN_ARCH_TRIPLET binutils-$DEBIAN_ARCH_TRIPLET && \
# rustup target add "$RUST_ARCH_TRIPLET" && \
# : https://github.com/rust-lang/cargo/issues/4133 && \
# echo "RUSTFLAGS='-C linker=$DEBIAN_ARCH_TRIPLET-gcc'; export RUSTFLAGS" >>/root/dynenv; \
# fi
# Configure cross-build environment if need be
RUN set -x && \
if [ "$TARGETPLATFORM" != "$BUILDPLATFORM" ]; then \
. /root/dynenv && \
apt install -y gcc-$DEBIAN_ARCH_TRIPLET binutils-$DEBIAN_ARCH_TRIPLET && \
rustup target add "$RUST_ARCH_TRIPLET" && \
: https://github.com/rust-lang/cargo/issues/4133 && \
echo "RUSTFLAGS='-C linker=$DEBIAN_ARCH_TRIPLET-gcc'; export RUSTFLAGS" >>/root/dynenv; \
fi
# Build
RUN set -x && \
cargo xtask release-runtime 600
## Run tests if requested, expted when cross-building
#ARG cucumber=0
#RUN if [ "$cucumber" != 0 ] && [ "$TARGETPLATFORM" = "$BUILDPLATFORM" ]; then \
# cargo test --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests && \
# cargo cucumber -i account_creation* && \
# cargo cucumber -i certification* && \
# cargo cucumber -i identity_creation* && \
# cargo cucumber -i monetary_mass* && \
# cargo cucumber -i oneshot_account* && \
# cargo cucumber -i transfer_all* && \
# cd target/debug/deps/ && \
# rm cucumber_tests-*.d && \
# mv cucumber_tests* ../../../build/duniter-cucumber; \
# fi
cat /root/dynenv && \
. /root/dynenv && \
cargo build --locked $CARGO_OPTIONS --target "$RUST_ARCH_TRIPLET" && \
mkdir -p build && \
mv target/$RUST_ARCH_TRIPLET/$TARGET_FOLDER/duniter build/
# Run tests if requested, expted when cross-building
ARG cucumber=0
RUN if [ "$cucumber" != 0 ] && [ "$TARGETPLATFORM" = "$BUILDPLATFORM" ]; then \
cargo test --workspace --exclude duniter-end2end-tests --exclude duniter-live-tests && \
cargo cucumber -i account_creation* && \
cargo cucumber -i certification* && \
cargo cucumber -i identity_creation* && \
cargo cucumber -i monetary_mass* && \
cargo cucumber -i oneshot_account* && \
cargo cucumber -i transfer_all* && \
cd target/debug/deps/ && \
rm cucumber_tests-*.d && \
mv cucumber_tests* ../../../build/duniter-cucumber; \
fi
# ------------------------------------------------------------------------------
# Final Stage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment