package docker container

This commit is contained in:
Aravinth Manivannan 2021-10-29 20:38:56 +05:30
parent 4d5f6ebd6f
commit eacb1b108a
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
4 changed files with 40 additions and 1 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
/target
tarpaulin-report.html
.env
cobertura.xml
coverage/
node_modules/
/static/cache/bundle/*
scripts/creds.py

20
Dockerfile Normal file
View File

@ -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"]

View File

@ -1,5 +1,4 @@
<div align="center">
<img width="120px" src="./static/cache/img/logo.svg" alt="pages logo">
<h1> Pages </h1>
<p>

12
scripts/entrypoint.sh Normal file
View File

@ -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