-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change user inside docker container from root -> ubuntu (id 1000:1000) (
#46) * Change user inside docker container from root -> ubuntu (id 1000:1000) * Add permission check for models directory in init_config
- Loading branch information
Showing
2 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,52 +18,59 @@ RUN apt update && \ | |
protobuf-compiler \ | ||
&& apt clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Use ubuntu user | ||
USER ubuntu | ||
WORKDIR /home/ubuntu | ||
|
||
# Install Rust | ||
ENV RUST_TOOLCHAIN=nightly-2024-09-30 | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ | ||
/root/.cargo/bin/rustup toolchain install ${RUST_TOOLCHAIN} && \ | ||
/root/.cargo/bin/rustup default ${RUST_TOOLCHAIN} && \ | ||
/root/.cargo/bin/rustup toolchain remove stable | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
~/.cargo/bin/rustup toolchain install ${RUST_TOOLCHAIN} && \ | ||
~/.cargo/bin/rustup default ${RUST_TOOLCHAIN} && \ | ||
~/.cargo/bin/rustup toolchain remove stable | ||
ENV PATH="~/.cargo/bin:${PATH}" | ||
|
||
# Install Jolt | ||
#ENV JOLT_VERSION=dd9e5c4bcf36ffeb75a576351807f8d86c33ec66 | ||
#RUN cargo +${RUST_TOOLCHAIN} install --git https://github.com/a16z/jolt --rev ${JOLT_VERSION} --force --bins jolt | ||
|
||
# Install node et al. | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash && \ | ||
export NVM_DIR="/root/.nvm" && \ | ||
export NVM_DIR="/home/ubuntu/.nvm" && \ | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ | ||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && \ | ||
nvm install 20 && \ | ||
npm install --prefix /root/.snarkjs [email protected] && \ | ||
ln -s $(which node) /usr/bin/node && \ | ||
ln -s $(which npm) /usr/bin/npm | ||
npm install --prefix /home/ubuntu/.snarkjs [email protected] && \ | ||
mkdir -p ~/.local/bin && \ | ||
ln -s $(which node) /home/ubuntu/.local/bin/node && \ | ||
ln -s $(which npm) /home/ubuntu/.local/bin/npm | ||
ENV PATH="/home/ubuntu/.local/bin:${PATH}" | ||
|
||
# Copy omron and install Python dependencies | ||
COPY neurons /opt/omron/neurons | ||
COPY pyproject.toml /opt/omron/pyproject.toml | ||
COPY uv.lock /opt/omron/uv.lock | ||
# Copy omron and install Python dependencies (make sure owner is ubuntu) | ||
RUN mkdir -p /home/ubuntu/omron/neurons | ||
COPY neurons /home/ubuntu/omron/neurons | ||
COPY pyproject.toml /home/ubuntu/omron/pyproject.toml | ||
COPY uv.lock /home/ubuntu/omron/uv.lock | ||
RUN pipx install uv && \ | ||
cd /opt/omron && \ | ||
/root/.local/bin/uv sync --locked && \ | ||
/root/.local/bin/uv cache clean && \ | ||
echo "source /opt/omron/.venv/bin/activate" >> ~/.bashrc | ||
ENV PATH="/opt/omron/.venv/bin:${PATH}" | ||
cd ~/omron && \ | ||
~/.local/bin/uv sync --locked && \ | ||
~/.local/bin/uv cache clean && \ | ||
echo "source ~/omron/.venv/bin/activate" >> ~/.bashrc | ||
ENV PATH="/home/ubuntu/omron/.venv/bin:${PATH}" | ||
|
||
# Set workdir for running miner.py or validator.py and compile circuits | ||
WORKDIR /opt/omron/neurons | ||
WORKDIR /home/ubuntu/omron/neurons | ||
ENV OMRON_NO_AUTO_UPDATE=1 | ||
RUN OMRON_DOCKER_BUILD=1 python3 miner.py && \ | ||
rm -rf /opt/omron/neurons/deployment_layer/*/target/release/build && \ | ||
rm -rf /opt/omron/neurons/deployment_layer/*/target/release/deps && \ | ||
rm -rf /opt/omron/neurons/deployment_layer/*/target/release/examples && \ | ||
rm -rf /opt/omron/neurons/deployment_layer/*/target/release/incremental && \ | ||
rm -rf /root/.bittensor | ||
ENTRYPOINT ["/opt/omron/.venv/bin/python3"] | ||
rm -rf ~/omron/neurons/deployment_layer/*/target/release/build && \ | ||
rm -rf ~/omron/neurons/deployment_layer/*/target/release/deps && \ | ||
rm -rf ~/omron/neurons/deployment_layer/*/target/release/examples && \ | ||
rm -rf ~/omron/neurons/deployment_layer/*/target/release/incremental && \ | ||
rm -rf ~/.bittensor | ||
ENTRYPOINT ["/home/ubuntu/omron/.venv/bin/python3"] | ||
CMD ["-c", "import subprocess; \ | ||
subprocess.run(['/opt/omron/.venv/bin/python3', '/opt/omron/neurons/miner.py', '--help']); \ | ||
subprocess.run(['/opt/omron/.venv/bin/python3', '/opt/omron/neurons/validator.py', '--help']);" \ | ||
subprocess.run(['/home/ubuntu/omron/.venv/bin/python3', '/home/ubuntu/omron/neurons/miner.py', '--help']); \ | ||
subprocess.run(['/home/ubuntu/omron/.venv/bin/python3', '/home/ubuntu/omron/neurons/validator.py', '--help']);" \ | ||
] | ||
# Axon server | ||
EXPOSE 8091/tcp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters