45 lines
1.2 KiB
Docker
45 lines
1.2 KiB
Docker
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
|