From bb9f1701349b52d6029caa297a58a9925276bec9 Mon Sep 17 00:00:00 2001 From: Andy Pack Date: Mon, 1 May 2023 08:47:46 +0100 Subject: [PATCH] adding dockerfile and jenkinsfile --- .dockerignore | 2 ++ .jenkins/jenkinsfile | 22 ++++++++++++++++++++++ Dockerfile | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .dockerignore create mode 100644 .jenkins/jenkinsfile create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..39e6caf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +pkg +target \ No newline at end of file diff --git a/.jenkins/jenkinsfile b/.jenkins/jenkinsfile new file mode 100644 index 0000000..1afaee7 --- /dev/null +++ b/.jenkins/jenkinsfile @@ -0,0 +1,22 @@ +pipeline { + agent any + + stages { + stage('Deploy') { + when { branch 'master' } + steps { + script { + docker.withRegistry('https://git.sarsoo.xyz', 'git-registry-creds') { + + docker.build("sarsoo/draught:latest").push() + } + } + } + } + } + post { + always { + cleanWs() + } + } +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..18e6677 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM rust:1.69 AS rust-build + +RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + +COPY . ./ + +RUN wasm-pack build --release +RUN cargo doc --no-deps --document-private-items + +FROM node:18 AS js-build + +COPY . ./ +COPY --from=rust-build /pkg /pkg +WORKDIR /www +RUN npm ci +RUN npm run build --if-present +COPY --from=rust-build /target/doc /www/dist/ + +FROM nginx +COPY --from=js-build /www/dist /usr/share/nginx/html/ \ No newline at end of file