2023-07-04 11:46:49 +00:00
|
|
|
# Variables
|
2024-05-31 08:23:11 +00:00
|
|
|
ARG BUILDER=ubuntu:24.04
|
2023-07-04 11:46:49 +00:00
|
|
|
ARG IMAGE=${BUILDER}
|
2024-05-31 08:23:11 +00:00
|
|
|
ARG RUST_VERSION=${RUST_VERSION:-1.78.0}
|
2023-07-04 11:46:49 +00:00
|
|
|
ARG BUILD_HOME=/src
|
|
|
|
ARG MAKE_PARALLEL=${MAKE_PARALLEL:-4}
|
2023-07-10 13:15:06 +00:00
|
|
|
ARG NIMFLAGS="${NIMFLAGS:-"-d:disableMarchNative"}"
|
2023-07-04 11:46:49 +00:00
|
|
|
ARG APP_HOME=/codex
|
2023-07-10 13:15:06 +00:00
|
|
|
ARG NAT_IP_AUTO=${NAT_IP_AUTO:-false}
|
2023-07-04 11:46:49 +00:00
|
|
|
|
|
|
|
# Build
|
|
|
|
FROM ${BUILDER} AS builder
|
2024-05-31 08:23:11 +00:00
|
|
|
ARG RUST_VERSION
|
2023-07-04 11:46:49 +00:00
|
|
|
ARG BUILD_HOME
|
|
|
|
ARG MAKE_PARALLEL
|
2023-07-10 13:15:06 +00:00
|
|
|
ARG NIMFLAGS
|
2023-07-04 11:46:49 +00:00
|
|
|
|
2024-05-31 08:23:11 +00:00
|
|
|
RUN apt-get update && apt-get install -y git cmake curl make bash lcov build-essential
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- --default-toolchain=${RUST_VERSION} -y
|
|
|
|
|
|
|
|
SHELL ["/bin/bash", "-c"]
|
|
|
|
ENV BASH_ENV="/etc/bash_env"
|
|
|
|
RUN echo "export PATH=$PATH:$HOME/.cargo/bin" >> $BASH_ENV
|
2023-06-19 06:28:27 +00:00
|
|
|
|
2023-07-04 11:46:49 +00:00
|
|
|
WORKDIR ${BUILD_HOME}
|
2023-03-08 11:45:55 +00:00
|
|
|
COPY . .
|
|
|
|
RUN make clean
|
2023-07-04 11:46:49 +00:00
|
|
|
RUN make -j ${MAKE_PARALLEL} update
|
2023-07-10 13:15:06 +00:00
|
|
|
RUN make -j ${MAKE_PARALLEL}
|
2023-07-04 11:46:49 +00:00
|
|
|
|
|
|
|
# Create
|
|
|
|
FROM ${IMAGE}
|
|
|
|
ARG BUILD_HOME
|
|
|
|
ARG APP_HOME
|
2023-07-10 13:15:06 +00:00
|
|
|
ARG NAT_IP_AUTO
|
2023-03-08 11:45:55 +00:00
|
|
|
|
2023-07-04 11:46:49 +00:00
|
|
|
WORKDIR ${APP_HOME}
|
|
|
|
COPY --from=builder ${BUILD_HOME}/build/codex /usr/local/bin
|
2024-05-31 08:23:11 +00:00
|
|
|
COPY --from=builder ${BUILD_HOME}/openapi.yaml .
|
|
|
|
COPY --from=builder --chmod=0755 ${BUILD_HOME}/docker/docker-entrypoint.sh /
|
2024-03-01 12:23:05 +00:00
|
|
|
RUN apt-get update && apt-get install -y libgomp1 bash curl jq && rm -rf /var/lib/apt/lists/*
|
2023-07-10 13:15:06 +00:00
|
|
|
ENV NAT_IP_AUTO=${NAT_IP_AUTO}
|
2023-07-04 11:46:49 +00:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
|
CMD ["codex"]
|