2021-11-30 15:27:32 +00:00
|
|
|
FROM node:16.0.0 as frontend
|
2021-07-15 09:57:01 +00:00
|
|
|
COPY package.json yarn.lock /src/
|
2021-05-12 12:07:11 +00:00
|
|
|
WORKDIR /src
|
|
|
|
RUN yarn install
|
2021-07-15 09:57:01 +00:00
|
|
|
WORKDIR /
|
|
|
|
RUN mkdir -p /src/static/cache/bundle
|
|
|
|
COPY tsconfig.json webpack.config.js jest.config.ts /src/
|
|
|
|
COPY templates /src/templates
|
|
|
|
WORKDIR /src
|
2021-05-12 12:07:11 +00:00
|
|
|
RUN yarn build
|
2021-11-30 15:27:32 +00:00
|
|
|
COPY scripts /src/scripts
|
|
|
|
RUN /src/scripts/librejs.sh
|
2021-12-02 14:58:17 +00:00
|
|
|
RUN /src/scripts/cachebust.sh
|
2021-05-12 12:07:11 +00:00
|
|
|
|
|
|
|
FROM rust:latest as rust
|
|
|
|
WORKDIR /src
|
2021-11-30 15:27:32 +00:00
|
|
|
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
|
|
|
COPY Cargo.toml .
|
|
|
|
RUN sed -i '/.*build.rs.*/d' Cargo.toml
|
|
|
|
COPY Cargo.lock .
|
|
|
|
COPY migrations /src/migrations
|
|
|
|
COPY sqlx-data.json /src/
|
|
|
|
COPY src/tests-migrate.rs /src/src/tests-migrate.rs
|
|
|
|
COPY src/settings.rs /src/src/settings.rs
|
|
|
|
RUN cargo --version
|
|
|
|
RUN cargo build --release
|
|
|
|
COPY . /src
|
2021-07-15 09:57:01 +00:00
|
|
|
COPY --from=frontend /src/static/cache/bundle /src/static/cache/bundle
|
2021-05-12 12:07:11 +00:00
|
|
|
RUN cargo build --release
|
2021-05-04 05:00:22 +00:00
|
|
|
|
2021-11-30 15:27:32 +00:00
|
|
|
FROM debian:bullseye
|
2021-12-01 15:48:30 +00:00
|
|
|
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
|
2021-06-02 12:47:25 +00: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" ]
|