mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
optimize meilisearch uffizzi build
even though docker cache was being used earlier for uffizzi builds, seems like the cache layers weren't persisting. This commit adds changes to move meilisearch building outside the dockerfile so that we can use the rust cache action. We are also building to the musl target so that the binary for meilisearch which is created can be used for the uffizzi ttyd image which uses alpine.
This commit is contained in:
parent
a3e41ba33e
commit
09a94e0db3
31
.github/uffizzi/Dockerfile
vendored
31
.github/uffizzi/Dockerfile
vendored
@ -1,24 +1,3 @@
|
|||||||
# Compile
|
|
||||||
FROM rust:alpine3.16 AS compiler
|
|
||||||
|
|
||||||
RUN apk add -q --update-cache --no-cache build-base openssl-dev
|
|
||||||
|
|
||||||
WORKDIR /meilisearch
|
|
||||||
|
|
||||||
ARG COMMIT_SHA
|
|
||||||
ARG COMMIT_DATE
|
|
||||||
ARG GIT_TAG
|
|
||||||
ENV COMMIT_SHA=${COMMIT_SHA} COMMIT_DATE=${COMMIT_DATE} VERGEN_GIT_SEMVER_LIGHTWEIGHT=${GIT_TAG}
|
|
||||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
RUN set -eux; \
|
|
||||||
apkArch="$(apk --print-arch)"; \
|
|
||||||
if [ "$apkArch" = "aarch64" ]; then \
|
|
||||||
export JEMALLOC_SYS_WITH_LG_PAGE=16; \
|
|
||||||
fi && \
|
|
||||||
cargo build --release
|
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
FROM uffizzi/ttyd:alpine
|
FROM uffizzi/ttyd:alpine
|
||||||
|
|
||||||
@ -29,19 +8,11 @@ ENV MEILI_NO_ANALYTICS true
|
|||||||
RUN apk update --quiet \
|
RUN apk update --quiet \
|
||||||
&& apk add -q --no-cache libgcc tini curl
|
&& apk add -q --no-cache libgcc tini curl
|
||||||
|
|
||||||
# add meilisearch to the `/bin` so you can run it from anywhere and it's easy
|
COPY target/x86_64-unknown-linux-musl/release/meilisearch /bin/meilisearch
|
||||||
# to find.
|
|
||||||
COPY --from=compiler /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
|
RUN ln -s /bin/meilisearch /meilisearch
|
||||||
|
|
||||||
# This directory should hold all the data related to meilisearch so we're going
|
|
||||||
# to move our PWD in there.
|
|
||||||
# We don't want to put the meilisearch binary
|
|
||||||
WORKDIR /meili_data
|
WORKDIR /meili_data
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 7700/tcp
|
EXPOSE 7700/tcp
|
||||||
|
|
||||||
ENTRYPOINT ["tini", "--"]
|
ENTRYPOINT ["tini", "--"]
|
||||||
|
20
.github/workflows/uffizzi-build.yml
vendored
20
.github/workflows/uffizzi-build.yml
vendored
@ -14,6 +14,26 @@ jobs:
|
|||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- run: sudo apt-get install musl-tools
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: Swatinem/rust-cache@v2.2.0
|
||||||
|
|
||||||
|
- name: Run cargo check without any default features
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: build
|
||||||
|
args: --target x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
|
- name: Remove dockerignore so we can use the target folder in our docker build
|
||||||
|
run: rm -f .dockerignore
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
6
.github/workflows/uffizzi-preview-deploy.yml
vendored
6
.github/workflows/uffizzi-preview-deploy.yml
vendored
@ -82,7 +82,7 @@ jobs:
|
|||||||
name: Use Remote Workflow to Preview on Uffizzi
|
name: Use Remote Workflow to Preview on Uffizzi
|
||||||
needs:
|
needs:
|
||||||
- cache-compose-file
|
- cache-compose-file
|
||||||
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@desc
|
uses: UffizziCloud/preview-action/.github/workflows/reusable.yaml@v2
|
||||||
with:
|
with:
|
||||||
# If this workflow was triggered by a PR close event, cache-key will be an empty string
|
# If this workflow was triggered by a PR close event, cache-key will be an empty string
|
||||||
# and this reusable workflow will delete the preview deployment.
|
# and this reusable workflow will delete the preview deployment.
|
||||||
@ -95,8 +95,8 @@ jobs:
|
|||||||
`meilisearch` command. You should be able to access this instance of meilisearch running in
|
`meilisearch` command. You should be able to access this instance of meilisearch running in
|
||||||
the preview from the link Meilisearch Endpoint link given below.
|
the preview from the link Meilisearch Endpoint link given below.
|
||||||
|
|
||||||
Web Terminal Endpoint : ${{ needs.cache-compose-file.outputs.expected-url }}
|
Web Terminal Endpoint : <uffizzi-url>
|
||||||
Meilisearch Endpoint : ${{ needs.cache-compose-file.outputs.expected-url }}/meilisearch
|
Meilisearch Endpoint : <uffizzi-url>/meilisearch
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
Loading…
Reference in New Issue
Block a user