docker: wasm build step
This commit is contained in:
parent
883aa122b2
commit
97db774e70
3 changed files with 29 additions and 12 deletions
|
@ -8,3 +8,7 @@ node_modules/
|
||||||
./templates/**/*.js
|
./templates/**/*.js
|
||||||
/static/cache/bundle/*
|
/static/cache/bundle/*
|
||||||
src/cache_buster_data.json
|
src/cache_buster_data.json
|
||||||
|
|
||||||
|
browser/target
|
||||||
|
browser/cobertura.xml
|
||||||
|
browser/docs
|
||||||
|
|
20
Dockerfile
20
Dockerfile
|
@ -1,16 +1,28 @@
|
||||||
FROM node:14.16.0 as frontend
|
FROM rust:latest as wasm
|
||||||
|
|
||||||
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
||||||
|
|
||||||
|
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
COPY browser/ /browser
|
||||||
|
WORKDIR /browser
|
||||||
|
RUN wasm-pack build --release
|
||||||
|
|
||||||
|
FROM node:14.16.0 as frontend
|
||||||
|
COPY package.json yarn.lock /src/
|
||||||
|
COPY --from=wasm /browser /src/browser
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
RUN yarn install
|
RUN yarn install
|
||||||
COPY . .
|
WORKDIR /
|
||||||
|
RUN mkdir -p /src/static/cache/bundle
|
||||||
|
COPY tsconfig.json webpack.config.js jest.config.ts /src/
|
||||||
|
COPY templates /src/templates
|
||||||
|
WORKDIR /src
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM rust:latest as rust
|
FROM rust:latest as rust
|
||||||
COPY --from=frontend /src /src
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
COPY --from=frontend /src/static/cache/bundle /src/static/cache/bundle
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
|
|
17
Makefile
17
Makefile
|
@ -2,11 +2,12 @@ default: frontend
|
||||||
cargo build
|
cargo build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cargo clean
|
@cargo clean
|
||||||
rm -rf browser/pkg || true
|
@yarn cache clean
|
||||||
rm ./src/cache_buster_data.json || true
|
@-rm -rf browser/pkg
|
||||||
rm -rf ./static/cache/bundle || true
|
@-rm ./src/cache_buster_data.json
|
||||||
rm -rf ./assets || true
|
@-rm -rf ./static/cache/bundle
|
||||||
|
@-rm -rf ./assets
|
||||||
|
|
||||||
coverage: migrate
|
coverage: migrate
|
||||||
cd browser && cargo tarpaulin -t 1200 --out Html
|
cd browser && cargo tarpaulin -t 1200 --out Html
|
||||||
|
@ -21,10 +22,10 @@ doc:
|
||||||
cargo doc --no-deps --workspace --all-features
|
cargo doc --no-deps --workspace --all-features
|
||||||
cd browser && cargo doc --no-deps --workspace --all-features
|
cd browser && cargo doc --no-deps --workspace --all-features
|
||||||
|
|
||||||
docker-build:
|
docker:
|
||||||
docker build -t mcaptcha/mcaptcha:master -t mcaptcha/mcaptcha:latest .
|
docker build -t mcaptcha/mcaptcha:master -t mcaptcha/mcaptcha:latest .
|
||||||
|
|
||||||
docker-publish: docker-build
|
docker-publish:
|
||||||
docker push mcaptcha/mcaptcha:master
|
docker push mcaptcha/mcaptcha:master
|
||||||
docker push mcaptcha/mcaptcha:latest
|
docker push mcaptcha/mcaptcha:latest
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ help:
|
||||||
@echo ' clean - drop builds and environments'
|
@echo ' clean - drop builds and environments'
|
||||||
@echo ' coverage - build test coverage in HTML format'
|
@echo ' coverage - build test coverage in HTML format'
|
||||||
@echo ' dev-env - download dependencies'
|
@echo ' dev-env - download dependencies'
|
||||||
@echo ' docker-build - build docker image'
|
@echo ' docker - build docker image'
|
||||||
@echo ' docker-publish - build and publish docker image'
|
@echo ' docker-publish - build and publish docker image'
|
||||||
@echo ' doc - build documentation'
|
@echo ' doc - build documentation'
|
||||||
@echo ' frontend - build static assets in prod mode'
|
@echo ' frontend - build static assets in prod mode'
|
||||||
|
|
Loading…
Reference in a new issue