40 lines
1.3 KiB
Docker
40 lines
1.3 KiB
Docker
# This image is for run purposes only, it will be used to run the node binary
|
|
|
|
# The command with docker buildx to create the image must be something like this with the args
|
|
# docker buildx build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t g6_node_runner:1.0 .
|
|
# And the execution command is like this
|
|
# docker run -it --name g6_node_runner --hostname g6 --rm -v $(pwd):/home/g6/workspace -v $HOME/runner/cargo_cache/:/home/g6/.cargo g6_node_runner:1.0
|
|
|
|
FROM debian:bookworm
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && \
|
|
apt-get upgrade -y && \
|
|
apt-get install -y \
|
|
libssl-dev \
|
|
protobuf-compiler \
|
|
llvm \
|
|
libudev-dev
|
|
|
|
# Create a user and group to run the application as a non-root user for security reasons
|
|
# The id of the user and group is the same as the one on the host machine to avoid permission issues this should be taken from args
|
|
ARG USER_ID
|
|
ARG GROUP_ID
|
|
|
|
RUN groupadd -g $GROUP_ID node && \
|
|
useradd -m -s /bin/bash -u $USER_ID -g $GROUP_ID g6
|
|
|
|
USER g6:node
|
|
|
|
# Set the working directory
|
|
WORKDIR /home/g6/workspace
|
|
RUN echo "alias ll='ls -la'" >> /home/g6/.bashrc
|
|
RUN echo "alias ..='cd ..'" >> /home/g6/.bashrc
|
|
RUN echo "alias ...='cd ../..'" >> /home/g6/.bashrc
|
|
|
|
# Set the environment
|
|
ENV USER=g6
|
|
ENV GROUP=node
|
|
ENV HOME=/home/g6
|
|
|