WIP - add dockerfile
This commit is contained in:
parent
02e24c0803
commit
c0471384e5
1 changed files with 45 additions and 0 deletions
45
Dockerfile
Normal file
45
Dockerfile
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
FROM docker.io/library/ubuntu:latest as build-stage
|
||||||
|
LABEL authors="joel"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get upgrade -y
|
||||||
|
RUN apt-get install --no-install-recommends -y rustup npm
|
||||||
|
|
||||||
|
RUN rustup default stable
|
||||||
|
RUN apt-get install --no-install-recommends -y gcc
|
||||||
|
RUN apt-get install --no-install-recommends -y gcc-multilib
|
||||||
|
|
||||||
|
RUN cargo install wasm-pack
|
||||||
|
|
||||||
|
RUN mkdir /build
|
||||||
|
WORKDIR /build/
|
||||||
|
|
||||||
|
COPY Cargo.toml Cargo.lock /build/
|
||||||
|
COPY --exclude=*/target/* wordgrid /build/wordgrid/
|
||||||
|
COPY --exclude=*/target/* --exclude=*/pkg/* wasm /build/wasm/
|
||||||
|
COPY --exclude=*/target/* server /build/server/
|
||||||
|
COPY --exclude=*/node_modules/* --exclude=*/dist/* ui /build/ui/
|
||||||
|
COPY resources /build/resources/
|
||||||
|
|
||||||
|
RUN cd wasm && ~/.cargo/bin/wasm-pack build --target=web
|
||||||
|
RUN cd ui && npm install
|
||||||
|
RUN cd ui && npm run build
|
||||||
|
RUN cd server && cargo build --release
|
||||||
|
|
||||||
|
|
||||||
|
FROM docker.io/library/ubuntu:latest as final-image
|
||||||
|
LABEL authors="joel"
|
||||||
|
|
||||||
|
WORKDIR /srv/
|
||||||
|
COPY --from=build-stage /build/ui/dist /srv/static
|
||||||
|
COPY --from=build-stage /build/target/release/server server
|
||||||
|
RUN cp /srv/static/*.csv dictionary.csv
|
||||||
|
RUN echo '{"dictionary_path": "dictionary.csv", "static_path": "static"}' > config.json
|
||||||
|
|
||||||
|
ENV ROCKET_ADDRESS=0.0.0.0
|
||||||
|
ENV ROCKET_PORT=8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["./server"]
|
||||||
|
EXPOSE 8000
|
Loading…
Reference in a new issue