diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..879c15e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +/target +tarpaulin-report.html +.env +cobertura.xml +coverage/ +node_modules/ +/static/cache/bundle/* +scripts/creds.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0782828 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM rust:1.56-slim-bullseye as rust +WORKDIR /src +RUN apt-get update && apt-get install -y git pkg-config libssl-dev +RUN mkdir src && echo "fn main() {}" > src/main.rs +COPY Cargo.toml . +RUN sed -i '/.*build.rs.*/d' Cargo.toml +COPY Cargo.lock . +RUN cargo build --release +COPY . /src +RUN cargo build --release + +FROM debian:bullseye-slim +#RUN useradd -ms /bin/bash -u 1000 pages +#RUN mkdir -p /var/www/pages && chown pages /var/www/pages +RUN apt-get update && apt-get install -y ca-certificates +COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh +COPY --from=rust /src/target/release/pages /usr/local/bin/ + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/README.md b/README.md index 94e1444..980eeae 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@
-pages logo

Pages

diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..a072312 --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +USER_ID=${LOCAL_USER_ID} +echo $USER_ID + +echo "Starting with UID : $USER_ID" +export HOME=/home/user +#adduser --disabled-password --shell /bin/bash --home $HOME --uid $USER_ID user +#--uid +sudo useradd --uid $USER_ID -b /home -m -s /bin/bash user +su - user +pages