Docker with perseus beta

pull/25/head
Miroito 3 years ago
parent 60061224af
commit 163fe66ccb

@ -4,13 +4,13 @@ FROM rust:1.66-slim AS build
# install build dependencies # install build dependencies
RUN apt update \ RUN apt update \
&& apt install -y --no-install-recommends lsb-release apt-transport-https \ && apt install -y --no-install-recommends lsb-release apt-transport-https \
build-essential curl wget pkg-config build-essential curl wget pkg-config libssl-dev
# vars # vars
ENV PERSEUS_VERSION=0.3.6 \ ENV PERSEUS_VERSION=0.4.0-beta.21 \
PERSEUS_SIZE_OPT_VERSION=0.1.9 \ PERSEUS_SIZE_OPT_VERSION=0.1.9 \
ESBUILD_VERSION=0.14.7 \ ESBUILD_VERSION=0.14.7 \
BINARYEN_VERSION=104 BINARYEN_VERSION=112
# prepare root project dir # prepare root project dir
WORKDIR /app WORKDIR /app
@ -32,24 +32,22 @@ WORKDIR /app/client
RUN cargo install perseus-cli --version $PERSEUS_VERSION RUN cargo install perseus-cli --version $PERSEUS_VERSION
# clean and prep app # clean and prep app
RUN perseus clean && perseus prep RUN perseus clean
# specify deps in app config # specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \ RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
&& sed -i s"/perseus-size-opt = .*/perseus-size-opt = \"${PERSEUS_SIZE_OPT_VERSION}\"/" ./Cargo.toml \ && sed -i s"/perseus-size-opt = .*/perseus-size-opt = \"${PERSEUS_SIZE_OPT_VERSION}\"/" ./Cargo.toml \
&& cat ./Cargo.toml && cat ./Cargo.toml
# modify lib.rs # modify main.rs
RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: true, opt_level: "s".to_string(), codegen_units: 1, enable_fluent_bundle_patch: false, }/' ./src/lib.rs \ RUN sed -i s'/SizeOpts::default()/SizeOpts { wee_alloc: true, lto: true, opt_level: "s".to_string(), codegen_units: 1, enable_fluent_bundle_patch: false, }/' ./src/main.rs \
&& cat ./src/lib.rs && cat ./src/main.rs
ARG API_URL ARG API_URL
ENV API_URL $API_URL ENV API_URL $API_URL
# run plugin(s) to adjust app # run plugin(s) to adjust app
RUN perseus tinker \ RUN perseus tinker
&& cat .perseus/Cargo.toml \
&& cat ./src/lib.rs
# single-threaded perseus CLI mode required for low memory environments # single-threaded perseus CLI mode required for low memory environments
#ENV PERSEUS_CLI_SEQUENTIAL=true #ENV PERSEUS_CLI_SEQUENTIAL=true
@ -75,8 +73,7 @@ RUN wget -nv https://github.com/WebAssembly/binaryen/releases/download/version_$
&& ./binaryen-version_${BINARYEN_VERSION}/bin/wasm-opt --version && ./binaryen-version_${BINARYEN_VERSION}/bin/wasm-opt --version
# run wasm-opt against bundle.wasm # run wasm-opt against bundle.wasm
RUN ./binaryen-version_${BINARYEN_VERSION}/bin/wasm-opt -Os ./client/pkg/dist/pkg/perseus_engine_bg.wasm -o ./client/pkg/dist/pkg/perseus_engine_bg.wasm \ RUN ./binaryen-version_${BINARYEN_VERSION}/bin/wasm-opt -Os ./client/pkg/dist/pkg/perseus_engine_bg.wasm -o ./client/pkg/dist/pkg/perseus_engine_bg.wasm
&& ls -lha ./client/pkg/dist/pkg
# prepare deployment image # prepare deployment image
FROM debian:stable-slim FROM debian:stable-slim
@ -88,4 +85,3 @@ COPY --from=build /app/client/pkg /app/
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0
CMD ./server CMD ./server

@ -11,6 +11,8 @@ services:
restart: always restart: always
ports: ports:
- 8080:8080 - 8080:8080
environment:
- PERSEUS_HOST=0.0.0.0
server: server:
container_name: fast-insiders-server container_name: fast-insiders-server
image: fast-insiders-server:latest image: fast-insiders-server:latest

Loading…
Cancel
Save