Skip to content

Commit

Permalink
fixed programming mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky-sideburn committed Aug 20, 2024
1 parent 32051e5 commit 3801a51
Show file tree
Hide file tree
Showing 12 changed files with 10,590 additions and 188 deletions.
37 changes: 1 addition & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
FROM nginx:stable

# Update repo and install some utilities and prerequisites
RUN apt-get update -y
RUN apt-get -y install git vim wget curl at gnupg procps
RUN apt-get -y install ca-certificates jq openssl task-spooler apt-transport-https python3 python3-pip redis libssl-dev
RUN apt-get -y install python3-yaml python3-kubernetes python3-redis python3-requests

# Install kubectl
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl

# Install Openresty
RUN wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -
RUN codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release` && echo "deb http://openresty.org/package/debian $codename openresty" | tee /etc/apt/sources.list.d/openresty.list
RUN apt-get update -y
RUN apt-get -y install openresty
RUN chmod 777 /usr/local/openresty/nginx

# Install LUA Module
RUN apt-get -y install luarocks lua-json lua-socket libyaml-dev
RUN apt-get update --fix-missing
RUN luarocks install luasec
RUN luarocks install lunajson
RUN luarocks install lyaml

# Install kube-linter
RUN curl -L -O https://github.com/stackrox/kube-linter/releases/download/0.6.0/kube-linter-linux.tar.gz
RUN tar -xvf kube-linter-linux.tar.gz && rm -f kube-linter-linux.tar.gz
RUN cp kube-linter /usr/local/bin/ && chmod 775 /usr/local/bin/kube-linter
RUN mkdir /tmp/kube-linter-pods && chmod 777 /tmp/kube-linter-pods

# Installl parser script for kubelinter
COPY kube-linter/kube-linter-parser.sh /opt/kube-linter-parser.sh
RUN chmod +x /opt/kube-linter-parser.sh
FROM 10.10.10.3:5000/local/kubeinvaders_base:develop

# Install KubeInvaders (html and js)
COPY html5/ /var/www/html
Expand Down
77 changes: 77 additions & 0 deletions Dockerfile_full
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM nginx:stable

# Update repo and install some utilities and prerequisites
RUN apt-get update -y
RUN apt-get -y install git vim wget curl at gnupg procps
RUN apt-get -y install ca-certificates jq openssl task-spooler apt-transport-https python3 python3-pip redis libssl-dev
RUN apt-get -y install python3-yaml python3-kubernetes python3-redis python3-requests

# Install kubectl
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl

# Install Openresty
RUN wget -O - https://openresty.org/package/pubkey.gpg | apt-key add -
RUN codename=`grep -Po 'VERSION="[0-9]+ \(\K[^)]+' /etc/os-release` && echo "deb http://openresty.org/package/debian $codename openresty" | tee /etc/apt/sources.list.d/openresty.list
RUN apt-get update -y
RUN apt-get -y install openresty
RUN chmod 777 /usr/local/openresty/nginx

# Install LUA Module
RUN apt-get -y install luarocks lua-json lua-socket libyaml-dev
RUN apt-get update --fix-missing
RUN luarocks install luasec
RUN luarocks install lunajson
RUN luarocks install lyaml

# Install kube-linter
RUN curl -L -O https://github.com/stackrox/kube-linter/releases/download/0.6.0/kube-linter-linux.tar.gz
RUN tar -xvf kube-linter-linux.tar.gz && rm -f kube-linter-linux.tar.gz
RUN cp kube-linter /usr/local/bin/ && chmod 775 /usr/local/bin/kube-linter
RUN mkdir /tmp/kube-linter-pods && chmod 777 /tmp/kube-linter-pods

# Installl parser script for kubelinter
COPY kube-linter/kube-linter-parser.sh /opt/kube-linter-parser.sh
RUN chmod +x /opt/kube-linter-parser.sh

# Install KubeInvaders (html and js)
COPY html5/ /var/www/html

# Configure Redis
COPY confs/redis/redis.conf /etc/redis/redis.conf

# Configure Nginx and KubeInvaders conf
RUN sed -i.bak 's/listen\(.*\)80;/listen 8081;/' /etc/nginx/conf.d/default.conf
RUN mkdir -p /usr/local/openresty/nginx/conf/kubeinvaders/data
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/KubeInvaders.conf /etc/nginx/conf.d/KubeInvaders.conf
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx /etc/nginx/conf.d
RUN chmod 777 /var/www/html

# Copy LUA scripts
COPY scripts/metrics.lua /usr/local/openresty/nginx/conf/kubeinvaders/metrics.lua
COPY scripts/pod.lua /usr/local/openresty/nginx/conf/kubeinvaders/pod.lua
COPY scripts/ingress.lua /usr/local/openresty/nginx/conf/kubeinvaders/ingress.lua
COPY scripts/node.lua /usr/local/openresty/nginx/conf/kubeinvaders/node.lua
COPY scripts/kube-linter.lua /usr/local/openresty/nginx/conf/kubeinvaders/kube-linter.lua
COPY scripts/chaos-node.lua /usr/local/openresty/nginx/conf/kubeinvaders/chaos-node.lua
COPY scripts/chaos-containers.lua /usr/local/openresty/nginx/conf/kubeinvaders/chaos-containers.lua
COPY scripts/programming_mode.lua /usr/local/openresty/nginx/conf/kubeinvaders/programming_mode.lua
COPY scripts/config_kubeinv.lua /usr/local/openresty/lualib/config_kubeinv.lua
COPY scripts/data/codenames.txt /usr/local/openresty/nginx/conf/kubeinvaders/data/codenames.txt

# Copy Python helpers
COPY scripts/programming_mode /opt/programming_mode/
COPY scripts/metrics_loop /opt/metrics_loop/
COPY scripts/logs_loop /opt/logs_loop/

EXPOSE 8080

ENV PATH=/usr/local/openresty/nginx/sbin:$PATH

COPY ./entrypoint.sh /

RUN chmod a+rwx ./entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
42 changes: 42 additions & 0 deletions Dockerfile_redux
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM 10.10.10.3:5000/local/kubeinvaders_base:develop

# Install KubeInvaders (html and js)
COPY html5/ /var/www/html

# Configure Redis
COPY confs/redis/redis.conf /etc/redis/redis.conf

# Configure Nginx and KubeInvaders conf
RUN sed -i.bak 's/listen\(.*\)80;/listen 8081;/' /etc/nginx/conf.d/default.conf
RUN mkdir -p /usr/local/openresty/nginx/conf/kubeinvaders/data
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/KubeInvaders.conf /etc/nginx/conf.d/KubeInvaders.conf
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx /etc/nginx/conf.d
RUN chmod 777 /var/www/html

# Copy LUA scripts
COPY scripts/metrics.lua /usr/local/openresty/nginx/conf/kubeinvaders/metrics.lua
COPY scripts/pod.lua /usr/local/openresty/nginx/conf/kubeinvaders/pod.lua
COPY scripts/ingress.lua /usr/local/openresty/nginx/conf/kubeinvaders/ingress.lua
COPY scripts/node.lua /usr/local/openresty/nginx/conf/kubeinvaders/node.lua
COPY scripts/kube-linter.lua /usr/local/openresty/nginx/conf/kubeinvaders/kube-linter.lua
COPY scripts/chaos-node.lua /usr/local/openresty/nginx/conf/kubeinvaders/chaos-node.lua
COPY scripts/chaos-containers.lua /usr/local/openresty/nginx/conf/kubeinvaders/chaos-containers.lua
COPY scripts/programming_mode.lua /usr/local/openresty/nginx/conf/kubeinvaders/programming_mode.lua
COPY scripts/config_kubeinv.lua /usr/local/openresty/lualib/config_kubeinv.lua
COPY scripts/data/codenames.txt /usr/local/openresty/nginx/conf/kubeinvaders/data/codenames.txt

# Copy Python helpers
COPY scripts/programming_mode /opt/programming_mode/
COPY scripts/metrics_loop /opt/metrics_loop/
COPY scripts/logs_loop /opt/logs_loop/

EXPOSE 8080

ENV PATH=/usr/local/openresty/nginx/sbin:$PATH

COPY ./entrypoint.sh /

RUN chmod a+rwx ./entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
Loading

0 comments on commit 3801a51

Please sign in to comment.