Skip to content

Commit f6e8a89

Browse files
🔧 Update Dockerfile to match with new version
1 parent 08b2097 commit f6e8a89

File tree

1 file changed

+62
-53
lines changed

1 file changed

+62
-53
lines changed

Dockerfile

Lines changed: 62 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
FROM projectoss/alpine:3.20.0
1+
FROM alpine:3.18
22

3-
# Install security updates first
4-
RUN apk update && apk upgrade
3+
# Metadata
4+
LABEL maintainer="dinushchathurya21@gmail.com"
5+
LABEL version="2.0.0-rc.1"
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"
510

6-
# Install required packages
11+
# Install base packages
712
RUN apk add --no-cache \
813
ca-certificates \
914
bash \
@@ -13,67 +18,71 @@ RUN apk add --no-cache \
1318
curl \
1419
gettext \
1520
openssl \
16-
python3 \
1721
py3-pip \
18-
unzip \
19-
groff
22+
python3 \
23+
netcat-openbsd \
24+
&& pip3 install --upgrade awscli \
25+
&& rm -rf /var/cache/apk/*
2026

21-
# Install AWS CLI v1 using pip (more compatible with Alpine)
22-
RUN pip3 install --break-system-packages --no-cache-dir awscli
27+
# Set environment variables
28+
ENV 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"
2335

24-
# Alternative: Install Python packages in virtual environment if needed
25-
# RUN python3 -m venv /opt/venv \
26-
# && /opt/venv/bin/pip install --no-cache-dir boto3 \
27-
# && ln -s /opt/venv/bin/python3 /usr/local/bin/python-venv
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 \
39+
&& chmod +x /usr/local/bin/kubectl
2840

29-
# Set versions - update these regularly
30-
ARG KUBECTL_VERSION="1.30.0"
31-
ARG HELM_VERSION="3.14.4"
32-
ARG KUBESEAL_VERSION="0.26.0"
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 \
44+
&& chmod +x /usr/local/bin/helm
3345

34-
# Install kubectl
35-
RUN curl -L "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl \
36-
&& curl -L "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" -o kubectl.sha256 \
37-
&& echo "$(cat kubectl.sha256) /usr/local/bin/kubectl" | sha256sum -c \
38-
&& chmod +x /usr/local/bin/kubectl \
39-
&& rm kubectl.sha256
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" \
49+
&& chmod +x ./aws-iam-authenticator \
50+
&& mv ./aws-iam-authenticator /usr/local/bin
4051

41-
# Install Helm using official installer script (more reliable)
42-
RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \
43-
&& chmod 700 get_helm.sh \
44-
&& ./get_helm.sh --version v${HELM_VERSION} \
45-
&& rm get_helm.sh
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
4655

47-
# Install kubeseal for sealed secrets support
48-
RUN curl -L "https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION}/kubeseal-${KUBESEAL_VERSION}-linux-amd64.tar.gz" -o kubeseal.tar.gz \
49-
&& tar -xzf kubeseal.tar.gz \
50-
&& mv kubeseal /usr/local/bin/ \
51-
&& chmod +x /usr/local/bin/kubeseal \
52-
&& rm kubeseal.tar.gz
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
5359

54-
# Create non-root user for security
55-
RUN addgroup -g 1001 runner && \
56-
adduser -D -u 1001 -G runner runner
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
5764

58-
# Set up directories with proper permissions
59-
RUN mkdir -p /opt/kubernetes /opt/helm /app && \
60-
chown -R runner:runner /opt/kubernetes /opt/helm /app
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
6172

62-
# Environment variables
63-
ENV KUBECONFIG="/opt/kubernetes/config"
64-
ENV HELM_HOME="/opt/helm"
65-
ENV XDG_CONFIG_HOME="/opt/helm"
66-
ENV HELM_CACHE_HOME="/opt/helm/cache"
67-
ENV PYTHONUNBUFFERED=1
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
6876

69-
# Copy files
70-
COPY --chown=runner:runner . /app/
71-
WORKDIR /app
77+
# Set working directory
78+
WORKDIR /opt/scripts
7279

73-
# Make scripts executable
74-
RUN chmod +x /app/entrypoint.sh /app/scripts/*.sh
80+
# Add health check
81+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
82+
CMD /health-check.sh
7583

76-
# Switch to non-root user
84+
# Security: Use non-root user for execution
7785
USER runner
7886

79-
ENTRYPOINT ["/app/entrypoint.sh"]
87+
# Set the entrypoint
88+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)