mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-23 01:54:22 +00:00
Fix some more compilation
This commit is contained in:
parent
1d91b2619d
commit
33163ab39f
1 changed files with 32 additions and 18 deletions
50
Dockerfile
50
Dockerfile
|
@ -1,58 +1,72 @@
|
||||||
FROM --platform=${BUILDPLATFORM} rust:1.68-bullseye AS builder
|
FROM --platform=${BUILDPLATFORM} rust:1.68-bullseye AS builder
|
||||||
ARG BUILDPLATFORM
|
ARG BUILDPLATFORM
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
ARG RUSTTARGET
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get upgrade --assume-yes
|
apt-get upgrade --assume-yes
|
||||||
|
|
||||||
RUN \
|
|
||||||
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
|
||||||
apt-get install --assume-yes gcc-x86-64-linux-gnu; \
|
|
||||||
fi && \
|
|
||||||
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
|
||||||
apt-get install --assume-yes gcc-aarch64-linux-gnu; \
|
|
||||||
fi && \
|
|
||||||
if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
|
||||||
apt-get install --assume-yes gcc-arm-linux-gnueabihf; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
mkdir .cargo && \
|
mkdir .cargo && \
|
||||||
echo '[net]' >> .cargo/config.toml && \
|
echo '[net]' >> .cargo/config.toml && \
|
||||||
echo 'git-fetch-with-cli = true' >> .cargo/config.toml && \
|
echo 'git-fetch-with-cli = true' >> .cargo/config.toml && \
|
||||||
|
echo >> .cargo/config.toml && \
|
||||||
if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then \
|
if [ "${BUILDPLATFORM}" != "${TARGETPLATFORM}" ]; then \
|
||||||
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
||||||
|
apt-get install --assume-yes gcc-x86-64-linux-gnu; \
|
||||||
echo '[target.x86_64-unknown-linux-gnu]' >> .cargo/config.toml; \
|
echo '[target.x86_64-unknown-linux-gnu]' >> .cargo/config.toml; \
|
||||||
echo 'linker = "x86-64-linux-gnu-gcc"' >> .cargo/config.toml; \
|
echo 'linker = "x86-64-linux-gnu-gcc"' >> .cargo/config.toml; \
|
||||||
|
echo >> .cargo/config.toml; \
|
||||||
fi && \
|
fi && \
|
||||||
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
||||||
|
apt-get install --assume-yes gcc-aarch64-linux-gnu; \
|
||||||
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml; \
|
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml; \
|
||||||
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml; \
|
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml; \
|
||||||
|
echo >> .cargo/config.toml; \
|
||||||
fi && \
|
fi && \
|
||||||
if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
||||||
|
apt-get install --assume-yes gcc-arm-linux-gnueabihf; \
|
||||||
echo '[target.armv7-unknown-linux-gnueabihf]' >> .cargo/config.toml; \
|
echo '[target.armv7-unknown-linux-gnueabihf]' >> .cargo/config.toml; \
|
||||||
echo 'linker = "arm-linux-gnueabihf-gcc"' >> .cargo/config.toml; \
|
echo 'linker = "arm-linux-gnueabihf-gcc"' >> .cargo/config.toml; \
|
||||||
|
echo >> .cargo/config.toml; \
|
||||||
fi \
|
fi \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RUN rustup target add ${RUSTTARGET}
|
RUN \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
||||||
|
RUSTTARGET=x86_64-unknown-linux-gnu; \
|
||||||
|
fi && \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
||||||
|
RUSTTARGET=aarch64-unknown-linux-gnu; \
|
||||||
|
fi && \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
||||||
|
RUSTTARGET=armv7-unknown-linux-gnueabihf; \
|
||||||
|
fi && \
|
||||||
|
rustup target add ${RUSTTARGET}
|
||||||
|
|
||||||
WORKDIR /usr/src/patched_porobot/
|
WORKDIR /usr/src/patched_porobot/
|
||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
|
|
||||||
RUN cargo build --all-features --bins --release --target=${RUSTTARGET}
|
RUN \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/amd64" ]; then \
|
||||||
|
RUSTTARGET=x86_64-unknown-linux-gnu; \
|
||||||
|
fi && \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
||||||
|
RUSTTARGET=aarch64-unknown-linux-gnu; \
|
||||||
|
fi && \
|
||||||
|
if [ "${TARGETPLATFORM}" = "linux/arm/v7" ]; then \
|
||||||
|
RUSTTARGET=armv7-unknown-linux-gnueabihf; \
|
||||||
|
fi && \
|
||||||
|
cargo build --all-features --bins --release --target=${RUSTTARGET}
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
FROM --platform=${TARGETPLATFORM} rust:1.68-slim-bullseye AS final
|
FROM --platform=${TARGETPLATFORM} rust:1.68-slim-bullseye AS final
|
||||||
ARG RUSTTARGET
|
|
||||||
|
|
||||||
WORKDIR /usr/src/patched_porobot/
|
WORKDIR /usr/src/patched_porobot/
|
||||||
COPY --from=builder \
|
COPY --from=builder \
|
||||||
/usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_discord \
|
/usr/src/patched_porobot/target/*/release/patched_porobot_discord \
|
||||||
/usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_telegram \
|
/usr/src/patched_porobot/target/*/release/patched_porobot_telegram \
|
||||||
/usr/src/patched_porobot/target/${RUSTTARGET}/release/patched_porobot_matrix \
|
/usr/src/patched_porobot/target/*/release/patched_porobot_matrix \
|
||||||
/usr/bin/
|
/usr/bin/
|
||||||
|
|
||||||
ENTRYPOINT []
|
ENTRYPOINT []
|
||||||
|
|
Loading…
Reference in a new issue