mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2025-11-24 14:35:46 +00:00
Docker: update image and optimize for layer caching
This commit is contained in:
parent
eedec7da34
commit
1883ef1c1c
19
Dockerfile
19
Dockerfile
@ -7,7 +7,7 @@ COPY browser/ /browser
|
|||||||
WORKDIR /browser
|
WORKDIR /browser
|
||||||
RUN wasm-pack build --release
|
RUN wasm-pack build --release
|
||||||
|
|
||||||
FROM node:14.16.0 as frontend
|
FROM node:16.0.0 as frontend
|
||||||
COPY package.json yarn.lock /src/
|
COPY package.json yarn.lock /src/
|
||||||
COPY --from=wasm /browser /src/browser
|
COPY --from=wasm /browser /src/browser
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
@ -18,14 +18,27 @@ COPY tsconfig.json webpack.config.js jest.config.ts /src/
|
|||||||
COPY templates /src/templates
|
COPY templates /src/templates
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
COPY scripts /src/scripts
|
||||||
|
RUN /src/scripts/librejs.sh
|
||||||
|
|
||||||
FROM rust:latest as rust
|
FROM rust:latest as rust
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||||
|
COPY Cargo.toml .
|
||||||
|
RUN sed -i '/.*build.rs.*/d' Cargo.toml
|
||||||
|
RUN sed -i '/.*browser.*/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
|
||||||
COPY --from=frontend /src/static/cache/bundle /src/static/cache/bundle
|
COPY --from=frontend /src/static/cache/bundle /src/static/cache/bundle
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM debian:buster
|
FROM debian:bullseye
|
||||||
RUN useradd -ms /bin/bash -u 1001 mcaptcha
|
RUN useradd -ms /bin/bash -u 1001 mcaptcha
|
||||||
WORKDIR /home/mcaptcha
|
WORKDIR /home/mcaptcha
|
||||||
COPY --from=rust /src/target/release/mcaptcha /usr/local/bin/
|
COPY --from=rust /src/target/release/mcaptcha /usr/local/bin/
|
||||||
|
|||||||
@ -9,6 +9,7 @@ Proof of work based, privacy respecting CAPTCHA system with a kickass UX.
|
|||||||
|
|
||||||
[](https://mcaptcha.github.io/mCaptcha/mCaptcha/)
|
[](https://mcaptcha.github.io/mCaptcha/mCaptcha/)
|
||||||
[](https://github.com/mCaptcha/mCaptcha/actions/workflows/linux.yml)
|
[](https://github.com/mCaptcha/mCaptcha/actions/workflows/linux.yml)
|
||||||
|
[](https://hub.docker.com/r/mcaptcha/mcaptcha)
|
||||||
[](https://deps.rs/repo/github/mCaptcha/mCaptcha)
|
[](https://deps.rs/repo/github/mCaptcha/mCaptcha)
|
||||||
[](https://codecov.io/gh/mCaptcha/mCaptcha)
|
[](https://codecov.io/gh/mCaptcha/mCaptcha)
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
"name": "vanilla",
|
"name": "vanilla",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --mode production",
|
"build": "webpack --mode production",
|
||||||
"lint": "yarn run eslint templates",
|
"lint": "yarn run eslint templates",
|
||||||
|
|||||||
@ -5,9 +5,9 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|||||||
//const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
|
//const WasmPackPlugin = require('@wasm-tool/wasm-pack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'inline-source-map',
|
//devtool: 'inline-source-map',
|
||||||
mode: 'development',
|
//mode: 'development',
|
||||||
//mode: 'production',
|
mode: 'production',
|
||||||
entry: {
|
entry: {
|
||||||
bundle: './templates/index.ts',
|
bundle: './templates/index.ts',
|
||||||
mobile: './templates/mobile.ts',
|
mobile: './templates/mobile.ts',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user