Merge pull request #3 from Northcode/master-rust

use alpine docker image and build in docker instead of jenkins
This commit is contained in:
AadneEM 2020-09-01 15:40:40 +02:00 committed by GitHub
commit 9f7e311069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 20 deletions

View File

@ -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'
CMD /usr/local/bin/rollux

13
Jenkinsfile vendored
View File

@ -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') {