Add Dockerfile

This commit is contained in:
xqtc161 2024-07-11 12:39:12 +02:00
parent 4f20a7632a
commit 8128164c00
2 changed files with 19 additions and 32 deletions

View file

@ -1,32 +0,0 @@
name: Rust Library Test
on: [push, pull_request]
jobs:
test:
runs-on: docker
steps:
- name: Checkout code
run: |
docker run --rm \
-v ${PWD}:/workspace \
-w /workspace \
alpine/git clone $CI_REPOSITORY_URL .
- name: Set up Rust
run: |
docker run --rm \
-v ${PWD}:/workspace \
-w /workspace \
rust:latest \
sh -c "rustup update"
- name: Run tests
run: |
docker run --rm \
-v ${PWD}:/workspace \
-w /workspace \
rust:latest \
sh -c "cargo test --lib"

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
FROM debian:bullseye@sha256:2c7a92a41cb814c00e7d455b2bc0c90ccdb9a4ced2ffdc10e562c7a84a186032
RUN apt-get update && apt-get install -y openssh-server gcc make dpkg-dev curl
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly --profile default -y
# RUN /root/.cargo/rustup default nightly
# RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host x86_64-unknown-linux-gnu --default-toolchain nightly --profile default -y
RUN /root/.cargo/bin/rustup target add x86_64-unknown-linux-gnu
WORKDIR /root
# RUN /root/.cargo/bin/cargo init
COPY Cargo.toml /root/Cargo.toml
COPY ./src/ /root/src
# COPY ./conf/ /root/conf
# COPY ./.cargo /root/.cargo
# RUN RUSTFLAGS='-Zlocation-detail=none' /root/.cargo/bin/cargo +nightly build -Zbuild-std --target x86_64-unknown-none --release
# RUN /root/.cargo/bin/cargo +nightly build --target x86_64-unknonenown-none --release
RUN /root/.cargo/bin/cargo +nightly test --lib --release
WORKDIR /wd
RUN echo "[+] Building..."
ENTRYPOINT ["/bin/bash", "-c", "/root/.cargo/bin/cargo +nightly build --target x86_64-unknown-none --release"]