From cc9ee4ee32c0a67c7e4d77fa089071daca269fc4 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Sun, 17 Nov 2024 00:28:55 -0700 Subject: [PATCH] chore: refactor docker build --- Dockerfile | 31 ++++++++++++++++++---------- Makefile | 2 -- apiclient/emailreceiver.go | 41 ++++++++++++++++++++++++++++++++++++++ pkg/alias/get.go | 22 +++++++++++++++----- tools/package-tools.sh | 19 +++++++++++++++++- 5 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 apiclient/emailreceiver.go diff --git a/Dockerfile b/Dockerfile index 756ff6cf..784cb799 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,25 @@ -FROM cgr.dev/chainguard/wolfi-base AS builder +FROM cgr.dev/chainguard/wolfi-base AS base -RUN apk add --no-cache go npm make git pnpm curl +RUN apk add --no-cache go make git npm pnpm + +FROM base AS bin WORKDIR /app COPY . . RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \ --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/.cache/uv \ --mount=type=cache,target=/root/go/pkg/mod \ - make in-docker-build + make all + +FROM base AS tools +RUN apk add --no-cache curl python-3.13 py3.13-pip +WORKDIR /app +COPY . . +RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \ + --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/root/.cache/uv \ + --mount=type=cache,target=/root/go/pkg/mod \ + UV_LINK_MODE=copy BIN_DIR=/bin make package-tools FROM cgr.dev/chainguard/wolfi-base AS final RUN apk add --no-cache git python-3.13 py3.13-pip openssh-server npm bash tini procps libreoffice @@ -16,13 +29,6 @@ RUN sed -E 's/^#(PermitRootLogin)no/\1yes/' /etc/ssh/sshd_config -i RUN ssh-keygen -A RUN mkdir /run/sshd && /usr/sbin/sshd COPY encryption.yaml / -COPY --from=builder /app/bin/otto8 /bin/ -COPY --link --from=builder /app/otto8-tools /otto8-tools -RUN < requirements.txt +uv pip install -r requirements.txt