bitque/crates/web/Dockerfile
2023-04-04 17:14:31 +02:00

30 lines
1.0 KiB
Docker

FROM archlinux:latest
RUN pacman -Sy rustup gcc which --noconfirm
WORKDIR /app/
RUN rustup toolchain install nightly && \
rustup default nightly && \
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
ADD ./bitque-data /app/bitque-data
ADD ./bitque-client /app/bitque-client
RUN cd ./bitque-client && \
rm -Rf build && \
mkdir build && \
wasm-pack build --mode normal --release --out-name bitque --out-dir ./build --target web && \
cp -r ./static/* ./build && \
cat ./static/index.js \
| sed -e "s/process.env.BITQUE_SERVER_BIND/'$BITQUE_SERVER_BIND'/g" \
| sed -e "s/process.env.BITQUE_SERVER_PORT/'$BITQUE_SERVER_PORT'/g" &> ./build/index.js && \
cp ./js/template.html ./build/index.html && \
mkdir -p /assets && \
cp -r ./build/* /assets
CMD cat /app/bitque-client/static/index.js \
| sed -e "s/process.env.BITQUE_SERVER_BIND/'$BITQUE_SERVER_BIND'/g" \
| sed -e "s/process.env.BITQUE_SERVER_PORT/'$BITQUE_SERVER_PORT'/g" &> /assets/index.js