2021-11-30 18:27:32 +03:00
|
|
|
FROM node:16.0.0 as frontend
|
2021-12-16 13:25:46 +03:00
|
|
|
RUN set -ex; \
|
|
|
|
apt-get update; \
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
apt-get install -y --no-install-recommends make
|
|
|
|
RUN mkdir -p /src/docs/openapi/
|
2021-07-15 12:57:01 +03:00
|
|
|
COPY package.json yarn.lock /src/
|
2021-12-16 13:25:46 +03:00
|
|
|
COPY docs/openapi/package.json docs/openapi/yarn.lock /src/docs/openapi/
|
|
|
|
WORKDIR /src
|
|
|
|
RUN yarn install && cd docs/openapi && yarn install
|
2021-05-12 15:07:11 +03:00
|
|
|
WORKDIR /src
|
2021-07-15 12:57:01 +03:00
|
|
|
RUN mkdir -p /src/static/cache/bundle
|
|
|
|
COPY tsconfig.json webpack.config.js jest.config.ts /src/
|
2021-12-16 13:25:46 +03:00
|
|
|
COPY templates /src/templates/
|
|
|
|
COPY docs/openapi /src/docs/openapi/
|
|
|
|
COPY Makefile /src/
|
2021-11-30 18:27:32 +03:00
|
|
|
COPY scripts /src/scripts
|
2021-12-16 13:25:46 +03:00
|
|
|
RUN make frontend
|
2021-05-12 15:07:11 +03:00
|
|
|
|
2022-05-28 13:52:34 +03:00
|
|
|
FROM rust:latest as planner
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
WORKDIR /src
|
|
|
|
COPY . /src/
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
FROM rust:latest as cacher
|
|
|
|
WORKDIR /src/
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
COPY --from=planner /src/recipe.json recipe.json
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
|
2021-05-12 15:07:11 +03:00
|
|
|
FROM rust:latest as rust
|
|
|
|
WORKDIR /src
|
2022-05-28 13:52:34 +03:00
|
|
|
COPY . .
|
|
|
|
COPY --from=cacher /src/target target
|
|
|
|
#COPY --from=cacher /src/db/db-core/target /src/db/db-core/target
|
|
|
|
#COPY --from=cacher /src/db/db-sqlx-postgres/target /src/db/db-sqlx-postgres/target
|
|
|
|
#COPY --from=cacher /src/db/db-migrations/target /src/db/db-migrations/target
|
|
|
|
#COPY --from=cacher /src/utils/cache-bust/target /src/utils/cache-bust/target
|
|
|
|
COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/
|
2021-11-30 18:27:32 +03:00
|
|
|
RUN cargo --version
|
2022-05-28 13:52:34 +03:00
|
|
|
RUN make cache-bust
|
2021-11-30 18:27:32 +03:00
|
|
|
RUN cargo build --release
|
2021-05-04 08:00:22 +03:00
|
|
|
|
2022-05-28 13:52:34 +03:00
|
|
|
FROM debian:bullseye as mCaptcha
|
2021-12-01 18:48:30 +03:00
|
|
|
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
2021-06-02 15:47:25 +03:00
|
|
|
RUN useradd -ms /bin/bash -u 1001 mcaptcha
|
|
|
|
WORKDIR /home/mcaptcha
|
|
|
|
COPY --from=rust /src/target/release/mcaptcha /usr/local/bin/
|
|
|
|
COPY --from=rust /src/config/default.toml /etc/mcaptcha/config.toml
|
|
|
|
USER mcaptcha
|
|
|
|
CMD [ "/usr/local/bin/mcaptcha" ]
|