blob: 57965f6014dc90210e28ac1c7f7c98b59436352f [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
FROM python:3.11-slim-bullseye
# Build argument: Version number (required)
ARG VERSION
# Fail build if VERSION is not provided
RUN if [ -z "$VERSION" ]; then echo "ERROR: VERSION build argument is required" && exit 1; fi
# Set environment variables
ENV IOTDB_HOME=/ainode \
PATH=$PATH:/ainode/sbin \
DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
unzip \
procps \
netcat-openbsd \
curl \
vim \
tzdata \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set working directory
WORKDIR /tmp
# Copy and extract the distribution package
# Note: Build context is project root (../../.. relative to this Dockerfile)
COPY distribution/target/apache-iotdb-${VERSION}-ainode-bin.zip /tmp/
# Extract and rename directory
RUN unzip -q apache-iotdb-${VERSION}-ainode-bin.zip \
&& mv apache-iotdb-${VERSION}-ainode-bin /ainode \
&& rm -f apache-iotdb-${VERSION}-ainode-bin.zip \
&& mkdir -p /ainode/logs /ainode/data/ainode
# Copy data directory from build server to image
# The build script copies /data/ainode to docker/src/main/ainode-build-data/ before build
# Note: The trailing slash is important - it copies contents not the directory itself
COPY docker/src/main/ainode-build-data/ /ainode/data/ainode/
# Set directory permissions
RUN chmod -R 755 /ainode/sbin \
&& chmod +x /ainode/sbin/*.sh \
&& chmod -R 777 /ainode/data /ainode/logs
# Health check configuration
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Expose ports
# 10810: AINode RPC port (ain_inference_rpc_port)
# 8080: Health check / management port
EXPOSE 10810 8080
# Copy entrypoint script (relative to project root)
COPY docker/src/main/ainode-entrypoint.sh /ainode/sbin/
RUN chmod +x /ainode/sbin/ainode-entrypoint.sh
# Set working directory
WORKDIR /ainode
# Use entrypoint script as startup command
ENTRYPOINT ["/ainode/sbin/ainode-entrypoint.sh"]
# Default command (can be overridden)
CMD ["start"]