adding dockerfile

This commit is contained in:
Andy Pack 2024-02-02 20:12:23 +00:00
parent fde4923a74
commit 26d1a1881a
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 53 additions and 21 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
target
.github
.jenkins

View File

@ -2,29 +2,41 @@ pipeline {
agent none agent none
stages { stages {
stage('Build') { // stage('Build') {
agent { // agent {
docker { // docker {
image 'rust:1.75.0-slim' // image 'rust:1.75.0-slim'
args '-u root' // args '-u root'
reuseNode true // reuseNode true
} // }
} // }
steps { // steps {
sh 'cargo build' // sh 'cargo build'
} // }
} // }
//
// stage('Test') {
// agent {
// docker {
// image 'rust:1.75.0-slim'
// args '-u root'
// reuseNode true
// }
// }
// steps {
// sh 'cargo test'
// }
// }
stage('Test') { stage('Deploy') {
agent { when { branch 'master' }
docker {
image 'rust:1.75.0-slim'
args '-u root'
reuseNode true
}
}
steps { steps {
sh 'cargo test' script {
docker.withRegistry('https://registry.sarsoo.xyz', 'git-registry-creds')
{
docker.build("sarsoo/dnstp:latest").push()
}
}
} }
} }
} }

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM rust:1.75.0-alpine3.19 as build
RUN apk add --no-cache musl-dev
COPY . /dnstp/
WORKDIR /dnstp
RUN cargo build --release
FROM alpine:3.19
COPY --from=build /dnstp/target/release/dnstp /dnstp/dnstp
WORKDIR /dnstp
EXPOSE 5353/udp
ENTRYPOINT ["/dnstp/dnstp"]
CMD ["--address", "0.0.0.0:5353"]