From b0a1ca56b180b5b060de076f5b2e639e92aee504 Mon Sep 17 00:00:00 2001 From: Aravinth Manivannan Date: Wed, 4 Oct 2023 22:44:20 +0530 Subject: [PATCH] feat: update docker base imgs and cleanup build --- Dockerfile | 39 ++------------------------------------- Makefile | 2 +- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8985904..8f18f54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,49 +1,14 @@ -#FROM node:16.0.0 as frontend -#RUN set -ex; \ -# apt-get update; \ -# DEBIAN_FRONTEND=noninteractive \ -# apt-get install -y --no-install-recommends make -#RUN mkdir -p /src/docs/openapi/ -#COPY package.json yarn.lock /src/ -#COPY docs/openapi/package.json docs/openapi/yarn.lock /src/docs/openapi/ -#WORKDIR /src -#RUN yarn install && cd docs/openapi && yarn install -#WORKDIR /src -#RUN mkdir -p /src/static/cache/bundle -#COPY tsconfig.json webpack.config.js jest.config.ts /src/ -#COPY templates /src/templates/ -#COPY docs/openapi /src/docs/openapi/ -#COPY Makefile /src/ -#COPY scripts /src/scripts -#RUN make frontend - -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 -#COPY --from=frontend /src/static/cache/bundle/ /src/static/cache/bundle/ RUN cargo --version -#RUN make cache-bust RUN cargo build --release -FROM debian:bullseye as dumbserve -LABEL org.opencontainers.image.source https://github.com/realaravinth/dumbserve +FROM debian:bookworm as dumbserve +LABEL org.opencontainers.image.source https://git.batsense.net/realaravinth/dumbserve RUN useradd -ms /bin/bash -u 1001 dumbserve WORKDIR /home/dumbserve COPY --from=rust /src/target/release/dumbserve /usr/local/bin/ -#COPY --from=rust /src/config/default.toml /etc/dumbserve/config.toml RUN mkdir /var/lib/dumbserve && chown dumbserve:dumbserve /var/lib/dumbserve USER dumbserve CMD [ "/usr/local/bin/dumbserve" ] diff --git a/Makefile b/Makefile index e6938dd..98329f8 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ doc: ## Generate documentation cargo doc --no-deps --workspace --all-features docker: ## Build Docker image - docker build -t realaravinth/dumbserve:master -t realaravinth/dumbserve:latest . + docker buildx build -t realaravinth/dumbserve:master -t realaravinth/dumbserve:latest --load . docker-publish: docker ## Build and publish Docker image docker push realaravinth/dumbserve:master