2024-01-22 17:51:49 +00:00
|
|
|
###
|
|
|
|
# STAGE: builder
|
|
|
|
# This stage is used to build the SurrealDB linux binary
|
|
|
|
###
|
|
|
|
|
|
|
|
FROM docker.io/rockylinux:8 as builder
|
|
|
|
|
|
|
|
|
|
|
|
RUN yum install -y gcc-toolset-13 git cmake llvm-toolset patch zlib-devel python3.11
|
|
|
|
|
|
|
|
# Install rust
|
|
|
|
ARG RUST_VERSION=1.75.0
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh
|
|
|
|
RUN bash /tmp/rustup.sh -y --default-toolchain ${RUST_VERSION}
|
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
|
|
|
|
RUN rustup target add x86_64-unknown-linux-gnu
|
|
|
|
RUN rustup target add aarch64-unknown-linux-gnu
|
|
|
|
|
|
|
|
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/opt/rh/gcc-toolset-13/root/usr/bin/aarch64-redhat-linux-gcc
|
|
|
|
|
|
|
|
WORKDIR /surrealdb
|
|
|
|
|
|
|
|
COPY docker/builder-entrypoint.sh /builder-entrypoint.sh
|
|
|
|
RUN chmod +x /builder-entrypoint.sh
|
|
|
|
|
|
|
|
ENTRYPOINT ["/builder-entrypoint.sh"]
|
|
|
|
|
|
|
|
###
|
|
|
|
# Final Images
|
|
|
|
###
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
#
|
2024-01-22 17:51:49 +00:00
|
|
|
# Development image (built on the CI environment)
|
2023-12-05 11:52:09 +00:00
|
|
|
#
|
2024-01-22 17:51:49 +00:00
|
|
|
FROM --platform=$TARGETPLATFORM cgr.dev/chainguard/glibc-dynamic:latest-dev as dev-ci
|
|
|
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
2023-12-05 11:52:09 +00:00
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
ARG ARTIFACT_PREFIX
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
USER root
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
COPY ${ARTIFACT_PREFIX}.${TARGETOS}-${TARGETARCH}/surreal /surreal
|
2023-12-05 11:52:09 +00:00
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
RUN chmod +x /surreal
|
|
|
|
|
|
|
|
ENTRYPOINT ["/surreal"]
|
|
|
|
|
|
|
|
#
|
|
|
|
# Development image (built on the CI environment)
|
|
|
|
#
|
|
|
|
FROM --platform=$TARGETPLATFORM cgr.dev/chainguard/glibc-dynamic:latest as prod-ci
|
2023-12-05 11:52:09 +00:00
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
ARG TARGETPLATFORM
|
|
|
|
|
|
|
|
COPY --from=dev-ci /surreal /surreal
|
|
|
|
|
|
|
|
ENTRYPOINT ["/surreal"]
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
#
|
2024-01-22 17:51:49 +00:00
|
|
|
# Development image (built locally)
|
2023-12-05 11:52:09 +00:00
|
|
|
#
|
|
|
|
FROM cgr.dev/chainguard/glibc-dynamic:latest-dev as dev
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
ARG SURREALDB_BINARY=target/release/surreal
|
|
|
|
|
|
|
|
COPY ${SURREALDB_BINARY} /surreal
|
|
|
|
|
|
|
|
RUN chmod +x /surreal
|
|
|
|
|
2023-12-05 11:52:09 +00:00
|
|
|
USER root
|
|
|
|
|
|
|
|
ENTRYPOINT ["/surreal"]
|
|
|
|
|
|
|
|
#
|
2024-01-22 17:51:49 +00:00
|
|
|
# Production image (built locally)
|
2023-12-05 11:52:09 +00:00
|
|
|
#
|
|
|
|
FROM cgr.dev/chainguard/glibc-dynamic:latest as prod
|
|
|
|
|
2024-01-22 17:51:49 +00:00
|
|
|
COPY --from=dev /surreal /surreal
|
2023-12-05 11:52:09 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/surreal"]
|