# Copyright 2024 RustFS Team # # Licensed 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. # Ubuntu-based development environment # Provides full development toolchain for building RustFS from source FROM ubuntu:22.04 ENV LANG=C.UTF-8 ENV DEBIAN_FRONTEND=noninteractive # Use faster mirrors for better build performance RUN sed -i s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g /etc/apt/sources.list # Install development dependencies RUN apt-get clean && apt-get update && apt-get install -y \ wget \ git \ curl \ unzip \ gcc \ pkg-config \ libssl-dev \ lld \ libdbus-1-dev \ libwayland-dev \ libwebkit2gtk-4.1-dev \ libxdo-dev \ ca-certificates \ bash \ vim \ nano \ htop \ tree \ && rm -rf /var/lib/apt/lists/* # Install protoc RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v31.1/protoc-31.1-linux-x86_64.zip \ && unzip protoc-31.1-linux-x86_64.zip -d protoc3 \ && mv protoc3/bin/* /usr/local/bin/ && chmod +x /usr/local/bin/protoc \ && mv protoc3/include/* /usr/local/include/ && rm -rf protoc-31.1-linux-x86_64.zip protoc3 # Install flatc RUN wget https://github.com/google/flatbuffers/releases/download/v25.2.10/Linux.flatc.binary.g++-13.zip \ && unzip Linux.flatc.binary.g++-13.zip \ && mv flatc /usr/local/bin/ && chmod +x /usr/local/bin/flatc && rm -rf Linux.flatc.binary.g++-13.zip # Install rust for development RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Install additional Rust tools for development RUN /root/.cargo/bin/cargo install \ cargo-watch \ cargo-nextest \ cargo-audit \ cargo-outdated # Copy cargo config for Chinese users COPY .docker/cargo.config.toml /root/.cargo/config.toml # Create development user RUN groupadd -g 1000 rustfs && \ useradd -d /app -g rustfs -u 1000 -s /bin/bash rustfs WORKDIR /app # Create data directories for testing RUN mkdir -p /data && chown -R rustfs:rustfs /data /app # Environment variables for development ENV RUSTFS_ACCESS_KEY=devadmin \ RUSTFS_SECRET_KEY=devadmin \ RUSTFS_ADDRESS=":9000" \ RUSTFS_CONSOLE_ENABLE=true \ RUSTFS_VOLUMES=/data \ RUST_LOG=debug \ RUST_BACKTRACE=1 EXPOSE 9000 # Development mode: keep container alive for interactive development CMD echo "RustFS Development Environment" && \ echo "Source code should be mounted at /app" && \ echo "Use 'cargo build' to build, 'cargo run' to run" && \ exec bash -c "while true; do sleep 1; done"