-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the dockerfile | Exit the script when error encountered
- Loading branch information
1 parent
7789221
commit 57804d8
Showing
5 changed files
with
38 additions
and
20 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
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
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 |
---|---|---|
@@ -1,25 +1,38 @@ | ||
FROM ubuntu:20.04 | ||
|
||
USER root | ||
RUN apt-get update && apt-get upgrade && apt-get install -y curl openssl jq python3 python3-pip wget ca-certificates && pip3 install pyyaml | ||
#COPY kubectl /root/ | ||
|
||
# Update, install dependencies, and clean up apt cache | ||
RUN apt-get update && apt-get upgrade -y | ||
|
||
RUN apt-get install -y --no-install-recommends curl openssl jq python3 python3-pip wget ca-certificates | ||
|
||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install pyyaml | ||
|
||
# Copy files to the image | ||
COPY kubeconfiggenerator.py /root/. | ||
COPY kubeconfiggenerator.sh /root/. | ||
ADD requirements.txt /root/requirements.txt | ||
RUN cd /root; pip3 install -r requirements.txt | ||
#RUN cp /root/kubectl bin/. && chmod +x /root/kubectl && chmod +x bin/kubectl && | ||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | ||
RUN install -o root -g root -m 0755 kubectl bin/kubectl | ||
RUN cp bin/kubectl /root/kubectl | ||
RUN chmod +x /root/kubectl && chmod +x bin/kubectl | ||
RUN chmod +x /root/kubeconfiggenerator.sh | ||
RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz \ | ||
&& gunzip helm-v3.12.1-linux-amd64.tar.gz \ | ||
&& tar -xvf helm-v3.12.1-linux-amd64.tar \ | ||
&& mv linux-amd64/helm bin/. | ||
|
||
# Install Python dependencies | ||
RUN cd /root && pip3 install -r requirements.txt | ||
|
||
# Install kubectl and clean up | ||
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \ | ||
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \ | ||
rm kubectl | ||
|
||
#ENTRYPOINT ["/root/kubeconfiggenerator.sh"] | ||
# Set executable permissions for scripts | ||
RUN chmod +x /root/kubeconfiggenerator.sh /root/kubeconfiggenerator.py | ||
|
||
# Install Helm, clean up tar files | ||
RUN wget https://get.helm.sh/helm-v3.12.1-linux-amd64.tar.gz && \ | ||
tar -xzf helm-v3.12.1-linux-amd64.tar.gz && \ | ||
mv linux-amd64/helm /usr/local/bin/helm && \ | ||
rm -rf helm-v3.12.1-linux-amd64.tar.gz linux-amd64 | ||
|
||
# Set default command to run the Python script | ||
EXPOSE 5005 | ||
CMD ["python3", "/root/kubeconfiggenerator.py"] | ||
|
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
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