1- FROM alpine:3.18
1+ # Use the specified Alpine base image
2+ FROM projectoss/alpine:3.14
23
3- # Metadata
4- LABEL maintainer="dinushchathurya21@gmail.com"
5- LABEL version="2.0.0"
6- LABEL description="EKS Helm Client with private infrastructure support"
7- LABEL org.opencontainers.image.source="https://github.com/open-source-srilanka/eks-helm-client-github-action"
8- LABEL org.opencontainers.image.description="Deploy Helm charts to EKS clusters with support for private clusters and registries"
9- LABEL org.opencontainers.image.licenses="MIT"
10-
11- # Install base packages
12- RUN apk add --no-cache \
13- ca-certificates \
14- bash \
15- git \
16- gnupg \
17- jq \
18- curl \
19- gettext \
20- openssl \
21- py3-pip \
22- python3 \
23- netcat-openbsd \
24- && pip3 install --upgrade awscli \
25- && rm -rf /var/cache/apk/*
26-
27- # Set environment variables
4+ # Set the KUBECONFIG environment variable to define where kubectl will look for its config file
285ENV KUBECONFIG="/opt/kubernetes/config"
29- ENV HELM_HOME="/opt/helm"
30- ENV XDG_CONFIG_HOME="/opt/helm"
31- ENV HELM_CACHE_HOME="/opt/helm/cache"
32- ENV HELM_CONFIG_HOME="/opt/helm"
33- ENV HELM_DATA_HOME="/opt/helm"
34- ENV PATH="/usr/local/bin:$PATH"
356
36- # Install kubectl (version will be overridden by input parameter)
37- ARG KUBECTL_VERSION="1.28.4"
38- RUN curl -s -L "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl \
7+ # Install necessary packages:
8+ # ca-certificates: For validating SSL/TLS connections
9+ # bash: Shell environment
10+ # git: For cloning Git repositories, potentially private Helm charts
11+ # gnupg: For verifying signed Helm charts or other secured assets (already present, ensuring it's there)
12+ # jq: A lightweight and flexible command-line JSON processor
13+ # py-pip: Python package installer, used for awscli
14+ # curl: Tool for transferring data with URL syntax (already present, ensuring it's there)
15+ # gettext: GNU gettext for internationalization (already present)
16+ RUN apk add --no-cache ca-certificates bash git gnupg jq py-pip \
17+ && apk add --update -t deps curl gettext \
18+ && pip install awscli
19+
20+ # Define argument for Kubernetes client (kubectl) version
21+ # Updated to a more recent stable version for better compatibility with newer EKS clusters
22+ ARG K8_VERSION="1.30.2"
23+ # Download and install kubectl
24+ RUN curl -s -L https://dl.k8s.io/release/v${K8_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl \
3925 && chmod +x /usr/local/bin/kubectl
4026
41- # Install Helm (version will be overridden by input parameter)
42- ARG HELM_VERSION="3.13.3"
43- RUN curl -s -L "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
27+ # Define argument for Helm version
28+ # Updated to the latest stable version for Helm 3
29+ ARG HELM_VERSION="3.14.4"
30+ # Download and install Helm
31+ RUN curl -s -L https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
4432 && chmod +x /usr/local/bin/helm
4533
46- # Install AWS IAM Authenticator
47- ARG IAM_AUTHENTICATOR_VERSION="0.6.14"
48- RUN curl -o aws-iam-authenticator "https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${IAM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${IAM_AUTHENTICATOR_VERSION}_linux_amd64" \
34+ # Define argument for AWS IAM Authenticator version
35+ # Updated to a more recent stable version
36+ ARG IAM_AUTHENTICATOR_VERSION="0.6.20"
37+ # Download, make executable, and move aws-iam-authenticator
38+ RUN curl -o aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${IAM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${IAM_AUTHENTICATOR_VERSION}_linux_amd64 \
4939 && chmod +x ./aws-iam-authenticator \
5040 && mv ./aws-iam-authenticator /usr/local/bin
5141
52- # Install eksctl for additional EKS operations
53- RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp \
54- && mv /tmp/eksctl /usr/local/bin
42+ # Clean up APK cache to reduce image size
43+ RUN rm -rf /var/cache/apk/*
5544
56- # Create necessary directories with proper permissions
57- RUN mkdir -p /opt/kubernetes /opt/helm /opt/scripts && \
58- chmod a+rwx /opt/kubernetes /opt/helm /opt/scripts
45+ # Create directories for Kubernetes config and Helm, and set appropriate permissions
46+ # These directories are used for storing configurations and cache
47+ RUN mkdir -p /opt/kubernetes && chmod a+rwx /opt/kubernetes && mkdir -p /opt/helm && chmod a+rwx /opt/helm
5948
60- # Create non-root user for better security
61- RUN addgroup -g 1000 runner && \
62- adduser -D -u 1000 -G runner runner && \
63- chown -R runner:runner /opt/kubernetes /opt/helm /opt/scripts
64-
65- # Copy configuration files and scripts
66- COPY templates/config.template /config.template
67- COPY templates/private-config.template /private-config.template
68- COPY scripts/entrypoint.sh /entrypoint.sh
69- COPY scripts/health-check.sh /health-check.sh
70- COPY scripts/setup-tools.sh /setup-tools.sh
71- COPY scripts/cleanup.sh /cleanup.sh
72-
73- # Set proper permissions for scripts
74- RUN chmod +x /entrypoint.sh /health-check.sh /setup-tools.sh /cleanup.sh && \
75- chown runner:runner /entrypoint.sh /health-check.sh /setup-tools.sh /cleanup.sh
49+ # Set Helm environment variables for cache and config home
50+ ENV HELM_HOME="/opt/helm"
51+ ENV XDG_CONFIG_HOME="/opt/helm"
52+ ENV HELM_CACHE_HOME="/opt/helm/cache"
7653
7754# Set working directory
78- WORKDIR /opt/scripts
55+ WORKDIR /
7956
80- # Add health check
81- HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
82- CMD /health-check.sh
57+ # Copy the entire context into the container. This should include entrypoint.sh and config.template
58+ ADD . .
8359
84- # Security: Use non-root user for execution
85- USER runner
60+ # Make the entrypoint script executable
61+ RUN chmod +x entrypoint.sh
8662
87- # Set the entrypoint
88- ENTRYPOINT ["/entrypoint.sh" ]
63+ # Set the entrypoint for the Docker container
64+ ENTRYPOINT [ "/entrypoint.sh" ]
0 commit comments