pkg docker

This commit is contained in:
Aravinth Manivannan 2021-10-31 22:55:47 +05:30
parent b2f928bc7f
commit ac9d4f753a
Signed by untrusted user: realaravinth
GPG key ID: AD9F0F08E855ED88
3 changed files with 28 additions and 3 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

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
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 1001 libmedium
RUN apt-get update && apt-get install -y ca-certificates
COPY --from=rust /src/target/release/libmedium /usr/local/bin/
USER libmedium
ENTRYPOINT ["/usr/local/bin/libmedium"]

View file

@ -14,11 +14,11 @@ doc: ## Prepare documentation
cargo doc --no-deps --workspace --all-features cargo doc --no-deps --workspace --all-features
docker: ## Build docker images docker: ## Build docker images
docker build -t realaravinth/pages:master -t realaravinth/pages:latest . docker build -t realaravinth/libmedium:master -t realaravinth/libmedium:latest .
docker-publish: docker ## Build and publish docker images docker-publish: docker ## Build and publish docker images
docker push realaravinth/pages:master docker push realaravinth/libmedium:master
docker push realaravinth/pages:latest docker push realaravinth/libmedium:latest
lint: ## Lint codebase lint: ## Lint codebase
cargo fmt -v --all -- --emit files cargo fmt -v --all -- --emit files