-
-
Save Ralim/e6de7face05746134d1173414c77716d to your computer and use it in GitHub Desktop.
Docker files for K8S kubespray
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
version: "3" | |
services: | |
k8s-setup: | |
stdin_open: true | |
tty: true | |
build: | |
context: . | |
command: /bin/bash | |
volumes: | |
- ./src:/home/pleb/src/src | |
- /tmp:/tmp |
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
FROM ubuntu:22.04 | |
RUN apt-get update && apt-get upgrade -y && apt-get -y install python3 python3-pip git curl wget nano bash sshpass | |
RUN mkdir -p /home/pleb | |
# Create an app user so our program doesn't run as root. | |
RUN groupadd -r pleb &&\ | |
useradd -g pleb -d /home/pleb -s /sbin/nologin -c "Docker" pleb | |
# Set the home directory to our pleb user's home. | |
ENV HOME=/home/pleb | |
ENV APP_HOME=/home/pleb/src | |
## SETTING UP THE APP ## | |
RUN mkdir $APP_HOME | |
WORKDIR $APP_HOME | |
RUN chown -R pleb:pleb $HOME | |
USER pleb | |
# Pull in kubespray | |
RUN git clone https://github.com/kubernetes-incubator/kubespray.git --recursive && cd kubespray && git pull && git reset --hard v2.20.0 | |
RUN cd kubespray && pip install --user -r requirements.txt | |
RUN cd kubespray && sed -i 's/- python-apt/- python3-apt\n - open-iscsi/g' roles/kubernetes/preinstall/vars/debian.yml | |
RUN cd kubespray && sed -i 's/- aufs-tools/- nfs-common/g' roles/kubernetes/preinstall/vars/debian.yml | |
COPY --chown=pleb:pleb ./src /home/pleb/src/src | |
ENV PATH="$HOME/.local/bin:$PATH" | |
# Default into our src folder | |
WORKDIR $APP_HOME/src |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment