Restructuring build flows to choose user as default but be overridable

This commit is contained in:
2026-05-11 01:15:45 -05:00
parent 3fe59e9740
commit bfb1a8e95e
13 changed files with 276 additions and 38 deletions

View File

@@ -1,6 +1,8 @@
# 1. A: Define a base image
FROM itdominator-base
ARG USERNAME=itdominator
# 1. B: Set ENV Variables
ENV NVM_VERSION=0.40.3
ENV NODE_VERSION=24.9.0
@@ -18,7 +20,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 2. Set the working directory inside the container
WORKDIR /home/abaddon/
WORKDIR /home/${USERNAME}
# 3. A: Install dependencies
RUN apt-get update
@@ -42,10 +44,10 @@ RUN npm --version
COPY Docker/opt/ /opt/
COPY Docker/scripts/run.sh .
RUN chmod +x /home/abaddon/run.sh
RUN chown abaddon:abaddon -R /home/abaddon
RUN chmod +x /home/${USERNAME}/run.sh
RUN chown ${USERNAME}:${USERNAME} -R /home/${USERNAME}
USER abaddon
USER ${USERNAME}
RUN ollama serve & sleep 5 && ollama pull llama3.1:8b
USER root
@@ -58,4 +60,4 @@ RUN rm -rf /tmp/*
RUN mkdir -p /tmp/apps
# 6. Expose Port and define the command used to run the app
CMD ["/home/abaddon/run.sh"]
CMD ["/home/itdominator/run.sh"]

View File

@@ -12,6 +12,9 @@ function main() {
cd "${SCRIPTPATH}/.."
echo "Working Dir: " $(pwd)
podman build -t "${CONTAINER}" -f Docker/Dockerfile .
podman build \
--build-arg USERNAME="${USER}" \
-t "${CONTAINER}" \
-f Docker/Dockerfile .
}
main $@;

View File

@@ -5,4 +5,6 @@
# set -o errunset ## To exit if a variable is referenced but not set
CONTAINER="ai-tools"
_HOME="${HOME}"
CONTAINER="ai-tools"
CONTAINER_HOME="${_HOME}"

View File

@@ -7,11 +7,6 @@
# set -o errunset ## To exit if a variable is referenced but not set
function set_routs() {
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 80 -j REDIRECT --to-ports 8080
sudo iptables -t nat -I OUTPUT -p tcp -o lo --dport 443 -j REDIRECT --to-ports 4433
}
function main() {
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
cd "${SCRIPTPATH}"
@@ -24,20 +19,19 @@ function main() {
fi
DOWNLOAD_HOST="${HOME}/Downloads"
DOWNLOAD_CONTAINER="${HOME}/Downloads"
DOWNLOAD_CONTAINER="${CONTAINER_HOME}/Downloads"
CODING_HOST="${HOME}/Coding"
CODING_CONTAINER="${HOME}/Coding"
CODING_CONTAINER="${CONTAINER_HOME}/Coding"
# set_routs
# sudo sysctl net.ipv4.ip_unprivileged_port_start=80
# -p 80:80 \
# -p 443:443 \
# sudo sysctl net.ipv4.ip_unprivileged_port_start=80
# podman run -m 4G \
# -p 80:80 \
# -p 443:443 \
# podman run -m 4G \
podman run -d -m 4G \
--annotation run.oci.cdi.devices=all \
-e NVIDIA_DRIVER_CAPABILITIES=video,compute,utility \
-e HOME="${HOME}" \
-e HOME="${CONTAINER_HOME}" \
-v "${DOWNLOAD_HOST}":"${DOWNLOAD_CONTAINER}" \
-v "${CODING_HOST}":"${CODING_CONTAINER}" \
"${CONTAINER}:latest"