From ff3963f7981219e052ece78b0d1357a5f5ba6ec8 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Mon, 23 May 2022 18:53:13 +0530 Subject: [PATCH] feat: setup docker packaging --- Dockerfile | 40 ++++++++++++++++++++++++++++++++++++++++ Makefile | 12 ++++++------ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..65e76c8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM rust:latest as rust +WORKDIR /src +#RUN mkdir /src/scripts +#COPY scripts/docker-cache.sh /src/scripts/docker-cache.sh +#RUN ./scripts/docker-cache.sh +# +#COPY Cargo.* /src/ +# +#COPY db/db-core/Cargo.* /src/db/db-core/ +# +#COPY db/db-sqlx-sqlite/Cargo.* /src/db/db-sqlx-sqlite/ +# +#COPY db/migrator/Cargo.* /src/db/migrator/ +# +#COPY forge/forge-core/Cargo.* /src/forge/forge-core/ +# +#COPY forge/gitea/Cargo.* /src/forge/gitea/ +#COPY utils/cache-bust/Cargo.* /src/utils/cache-bust/ +#COPY federate/federate-core/Cargo.* /src/federate/federate-core/ +#COPY federate/publiccodeyml/Cargo.* /src/federate/publiccodeyml/ +#RUN find /src/ +#RUN sed -i '/.*build.rs.*/d' Cargo.toml +# +#COPY db/db-sqlx-sqlite/migrations/ /src/db/db-sqlx-sqlite/migrations/ +#COPY db/db-sqlx-sqlite/sqlx-data.json /src/db/db-sqlx-sqlite/sqlx-data.json +#COPY Makefile /src/ +# +#RUN cargo --version +#RUN make release +COPY . /src/ +RUN make release + +FROM debian:bullseye +LABEL org.opencontainers.image.source https://github.com/forgeflux-org/starchart +RUN useradd -ms /bin/bash -u 1001 starchart +WORKDIR /home/mcaptcha +COPY --from=rust /src/target/release/starchart /usr/local/bin/ +COPY --from=rust /src/config/default.toml /etc/starchart/config.toml +USER starchart +CMD [ "/usr/local/bin/starchart" ] diff --git a/Makefile b/Makefile index 55b0b63..6c4e5c5 100644 --- a/Makefile +++ b/Makefile @@ -76,12 +76,12 @@ dev-env: ## Download development dependencies doc: ## Prepare documentation cargo doc --no-deps --workspace --all-features -#docker: ## Build docker images -# docker build -t realaravinth/gitpad:master -t realaravinth/gitpad:latest . -# -#docker-publish: docker ## Build and publish docker images -# docker push realaravinth/gitpad:master -# docker push realaravinth/gitpad:latest +docker: ## Build docker images + docker build -t forgedfed/starchart:master -t forgedfed/starchart:latest . + +docker-publish: docker ## Build and publish docker images + docker push forgedfed/starchart:master + docker push forgedfed/starchart:latest lint: ## Lint codebase cargo fmt -v --all -- --emit files