feat: docker img

This commit is contained in:
Aravinth Manivannan 2023-08-03 16:05:48 +05:30
parent 5445ec8a21
commit 7896dace9f
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
4 changed files with 57 additions and 0 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
/target
db
db.sqlite db.sqlite-shm db.sqlite-wal
graph/
run2.sh run3.sh run.sh
venv/
.env

5
.gitignore vendored
View file

@ -1,2 +1,7 @@
/target /target
db db
db.sqlite db.sqlite-shm db.sqlite-wal
graph/
run2.sh run3.sh run.sh
venv/
.env

View file

@ -0,0 +1,17 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO logs (string, salt, time, difficulty) VALUES ($1, $2, $3, $4) ON CONFLICT(difficulty) DO NOTHING;",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Varchar",
"Varchar",
"Int4",
"Int4"
]
},
"nullable": []
},
"hash": "5d59a2fc2e04273e22b9949031084b6fdff395c09bd63011bc8d28b09cd55e32"
}

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
# SPDX-FileCopyrightText: 2023 Aravinth Manivannan <realaravinth@batsense.net>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
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
FROM rust:latest as rust
WORKDIR /src
COPY . .
COPY --from=cacher /src/target target
RUN cargo build --release
FROM debian:bullseye as powd
LABEL org.opencontainers.image.source https://git.batsense.net/mcaptcha/powd
RUN useradd -ms /bin/bash -u 1001 powd
WORKDIR /home/powd
COPY --from=rust /src/target/release/powd /usr/local/bin/
USER powd
CMD [ "/usr/local/bin/powd" ]