mCaptcha/Dockerfile

40 lines
1.3 KiB
Text
Raw Normal View History

# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
2023-07-02 14:27:29 +00:00
FROM node:18.0.0 as frontend
2021-12-16 10:25:46 +00: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 09:57:01 +00:00
COPY package.json yarn.lock /src/
2021-12-16 10:25:46 +00: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 12:07:11 +00:00
WORKDIR /src
2021-07-15 09:57:01 +00:00
RUN mkdir -p /src/static/cache/bundle
COPY tsconfig.json webpack.config.js jest.config.ts /src/
2021-12-16 10:25:46 +00:00
COPY templates /src/templates/
COPY docs/openapi /src/docs/openapi/
COPY Makefile /src/
COPY scripts /src/scripts
2021-12-16 10:25:46 +00:00
RUN make frontend
2021-05-12 12:07:11 +00:00
FROM rust:latest as rust
WORKDIR /src
COPY . .
COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/
COPY --from=frontend /src/docs/openapi/dist/ /src/docs/openapi/dist/
RUN cargo --version
RUN make cache-bust
RUN cargo build --release
2021-05-04 05:00:22 +00:00
2023-10-16 14:34:19 +00:00
FROM debian:bookworm as mCaptcha
LABEL org.opencontainers.image.source https://github.com/mCaptcha/mCaptcha
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" ]