diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4406b23 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +pkg +target +dist +node_modules \ No newline at end of file diff --git a/.jenkins/jenkinsfile b/.jenkins/jenkinsfile new file mode 100644 index 0000000..3691a71 --- /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/game-of-life:latest").push() + } + } + } + } + } + post { + always { + cleanWs() + } + } +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..08f26c8 --- /dev/null +++ b/Dockerfile @@ -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/ \ No newline at end of file