diff --git a/Dockerfile b/Dockerfile index 36b572d..6e0fdc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,17 @@ -FROM debian +ARG BASE_IMAGE=ekidd/rust-musl-builder:latest -RUN apt update -RUN apt install libssl1.1 openssl ca-certificates +FROM ${BASE_IMAGE} AS builder -ADD target/release/rollux /bin/. +ADD --chown=rust:rust . ./ -RUN mkdir /app/ +RUN cargo build --release -WORKDIR /app/ +FROM alpine:latest + +RUN apk --no-cache add ca-certificates + +COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/rollux /usr/local/bin/ ENV DISCORD_TOKEN="invalid" -CMD '/bin/rollux' \ No newline at end of file +CMD /usr/local/bin/rollux diff --git a/Jenkinsfile b/Jenkinsfile index 02c0585..660b5a4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,21 +1,8 @@ pipeline { agent any stages { - stage('build') { - agent { - docker { - image 'rust' - reuseNode true - } - } - steps { - sh 'cargo build --release' - stash includes: 'target/release/rollux', name: 'app' - } - } stage('docker build') { steps { - unstash 'app' echo 'Starting docker image build' script { docker.withRegistry("https://pkg.northcode.no", 'docker-login') {