From 497742f9aca3fda56d7f372aed46b50891907185 Mon Sep 17 00:00:00 2001 From: Jochen maes Date: Sat, 21 Oct 2023 11:32:38 +0200 Subject: [PATCH] adds docker image Signed-off-by: Jochen maes --- .drone.yml | 20 ++++++++++++++++++++ Dockerfile | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..9ba71c3 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,20 @@ +--- +kind: pipeline +type: docker +name: docker-task-rust + +platform: + arch: amd64 + +steps: + - name: docker build + image: plugins/docker + settings: + username: sejo + password: + from_secret: gitea_token + registry: https://gitea.sejo-it.be + repo: sejo-it/drone-task-rust + tags: + - latest + - master diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..76f1858 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Base image. Change this to use another Rust version. +FROM rust:1.73-slim + +# Install Docker (for docker-in-docker) +RUN apt-get update \ + && apt-get install -y ca-certificates curl gnupg \ + && mkdir -p /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian bullseye stable" >> /etc/apt/sources.list.d/docker.list \ + && apt-get update \ + && apt-get install -y docker-ce-cli \ + && apt-get clean + +# Install cross v0.2.4 +RUN mkdir -p /usr/local/cargo/bin && curl -L https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C /usr/local/cargo/bin + +# (Optional) Pre-install rust targets +# This significantly reduces build time, at the cost of an increased image size +RUN rustup target add \ + aarch64-unknown-linux-gnu \ + aarch64-unknown-linux-musl \ + x86_64-unknown-linux-gnu \ + x86_64-unknown-linux-musl \ + && rustup component add --target aarch64-unknown-linux-gnu rust-src \ + && rustup component add --target aarch64-unknown-linux-musl rust-src \ + && rustup component add --target x86_64-unknown-linux-gnu rust-src \ + && rustup component add --target x86_64-unknown-linux-musl rust-src