From dfd9c384aad6b60e12f6eb1634bf6899c1e502db Mon Sep 17 00:00:00 2001 From: inductor Date: Tue, 7 Mar 2023 18:08:08 +0900 Subject: [PATCH 1/5] use docker cache --- .dockerignore | 1 + .github/workflows/publish-docker-images.yml | 7 +++++++ Dockerfile | 9 ++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8c6bdbdeb..c87217b16 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,4 @@ target Dockerfile .dockerignore .gitignore +.git \ No newline at end of file diff --git a/.github/workflows/publish-docker-images.yml b/.github/workflows/publish-docker-images.yml index 9ceeaaaa4..fa1f145da 100644 --- a/.github/workflows/publish-docker-images.yml +++ b/.github/workflows/publish-docker-images.yml @@ -58,9 +58,13 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64,linux/arm64 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + with: + platforms: linux/amd64,linux/arm64 - name: Login to Docker Hub uses: docker/login-action@v2 @@ -88,10 +92,13 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} + builder: ${{ steps.buildx.outputs.name }} build-args: | COMMIT_SHA=${{ github.sha }} COMMIT_DATE=${{ steps.build-metadata.outputs.date }} GIT_TAG=${{ github.ref_name }} + cache-from: type=gha + cache-to: type=gha,mode=max # /!\ Don't touch this without checking with Cloud team - name: Send CI information to Cloud team diff --git a/Dockerfile b/Dockerfile index 70950f338..b828894ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1.4 # Compile FROM rust:alpine3.16 AS compiler @@ -11,8 +12,10 @@ ARG GIT_TAG ENV VERGEN_GIT_SHA=${COMMIT_SHA} VERGEN_GIT_COMMIT_TIMESTAMP=${COMMIT_DATE} VERGEN_GIT_SEMVER_LIGHTWEIGHT=${GIT_TAG} ENV RUSTFLAGS="-C target-feature=-crt-static" -COPY . . -RUN set -eux; \ +COPY --link . . +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/meilisearch/target \ + set -eux; \ apkArch="$(apk --print-arch)"; \ if [ "$apkArch" = "aarch64" ]; then \ export JEMALLOC_SYS_WITH_LG_PAGE=16; \ @@ -30,7 +33,7 @@ RUN apk update --quiet \ # add meilisearch to the `/bin` so you can run it from anywhere and it's easy # to find. -COPY --from=compiler /meilisearch/target/release/meilisearch /bin/meilisearch +COPY --from=compiler --link /meilisearch/target/release/meilisearch /bin/meilisearch # To stay compatible with the older version of the container (pre v0.27.0) we're # going to symlink the meilisearch binary in the path to `/meilisearch` RUN ln -s /bin/meilisearch /meilisearch From 3e4a35663870d73dd4b5c9770a26da1c9a9616bc Mon Sep 17 00:00:00 2001 From: inductor Date: Tue, 7 Mar 2023 18:08:58 +0900 Subject: [PATCH 2/5] EOF --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index c87217b16..51bea9b35 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,4 @@ target Dockerfile .dockerignore .gitignore -.git \ No newline at end of file +.git From 85182497abcf8169e2e303253aee8ddfad9c7fea Mon Sep 17 00:00:00 2001 From: inductor Date: Tue, 18 Apr 2023 15:15:33 +0900 Subject: [PATCH 3/5] revert mount --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b828894ce..0d7593f79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,7 @@ ENV VERGEN_GIT_SHA=${COMMIT_SHA} VERGEN_GIT_COMMIT_TIMESTAMP=${COMMIT_DATE} ENV RUSTFLAGS="-C target-feature=-crt-static" COPY --link . . -RUN --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=/meilisearch/target \ - set -eux; \ +RUN set -eux; \ apkArch="$(apk --print-arch)"; \ if [ "$apkArch" = "aarch64" ]; then \ export JEMALLOC_SYS_WITH_LG_PAGE=16; \ From 11f47249578871c7f61f3b2fa9c2184c635d2f77 Mon Sep 17 00:00:00 2001 From: inductor Date: Tue, 18 Apr 2023 16:32:31 +0900 Subject: [PATCH 4/5] ignore all .git --- .dockerignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 51bea9b35..e5278220d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,5 @@ target Dockerfile .dockerignore .gitignore -.git +**/.git + From 8195d366faa123530def1990cc909d2987864414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar=20-=20curqui?= Date: Tue, 25 Apr 2023 16:48:25 +0200 Subject: [PATCH 5/5] Update .dockerignore --- .dockerignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index e5278220d..ef2e39bfc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,3 @@ Dockerfile .dockerignore .gitignore **/.git -