adding dockerfile, jenkinsfile

This commit is contained in:
Andy Pack 2023-05-01 17:01:42 +01:00
parent 4b801496cf
commit 42952cb34c
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
3 changed files with 49 additions and 0 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
pkg
target
dist
node_modules

22
.jenkins/jenkinsfile Normal file
View File

@ -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/game-of-life:latest").push()
}
}
}
}
}
post {
always {
cleanWs()
}
}
}

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM rust:1.69 AS rust-build
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
COPY . /gof
WORKDIR /gof
RUN wasm-pack build --release
RUN cargo doc --no-deps --document-private-items
FROM node:18 AS js-build
COPY . /gof
WORKDIR /gof
COPY --from=rust-build /gof/pkg /gof/pkg
WORKDIR /gof/www
RUN npm ci
RUN npm run build --if-present
COPY --from=rust-build /gof/target/doc /gof/www/dist/
FROM nginx
COPY --from=js-build /gof/www/dist /usr/share/nginx/html/