Skip to content

Commit 0d023f6

Browse files
committed
Bump CICD setup
1 parent aff4156 commit 0d023f6

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

cicd/Dockerfile

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ ARG KUBECTL_VERSION=v1.32.3
44
ARG HELM_VERSION=v3.17.0
55
ARG HCLOUD_VERSION=v1.50.0
66
ARG TERRAFORM_VERSION=1.11.4
7-
ARG TERRAGRUNT_VERSION=0.77.20
7+
ARG TERRAGRUNT_VERSION=1.0.0-rc1
88
ARG CIVO_VERSION=1.2.1
99
ARG ALIYUN_VERSION=3.0.270
10-
ARG USER_ID=1001
10+
ARG USER_ID=1000
11+
ARG GROUP_ID=1000
1112

1213
# Set environment variables
1314
ENV DEBIAN_FRONTEND=noninteractive \
14-
PATH=/root/.tfenv/bin:/root/.tgenv/bin:$PATH
15+
TFENV_ROOT=/opt/tfenv \
16+
TGENV_ROOT=/opt/tgenv \
17+
PATH=/opt/tfenv/bin:/opt/tgenv/bin:$PATH
1518

1619
# Install base packages and tools in a single layer
1720
# This reduces the number of layers and image size
@@ -33,6 +36,9 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \
3336
lsb-release \
3437
restic \
3538
rclone \
39+
iputils-ping \
40+
netcat-openbsd \
41+
dnsutils \
3642
&& rm -rf /var/lib/apt/lists/*
3743

3844
# Install Docker client
@@ -61,12 +67,10 @@ RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
6167
# Create a temporary working directory
6268
WORKDIR /tmp/downloads
6369

64-
# Install tfenv and tgenv for Terraform and Terragrunt version management
65-
RUN mkdir -p ~/.tfenv ~/.tgenv \
66-
&& git clone --depth=1 https://github.com/tfutils/tfenv.git ~/.tfenv \
67-
&& git clone --depth=1 https://github.com/cunymatthieu/tgenv.git ~/.tgenv \
68-
&& echo 'export PATH="${HOME}/.tfenv/bin:${PATH}"' >> ~/.bash_profile \
69-
&& echo 'export PATH="$HOME/.tgenv/bin:$PATH"' >> ~/.bash_profile
70+
# Install tfenv and tgenv in shared location
71+
RUN git clone --depth=1 https://github.com/tfutils/tfenv.git /opt/tfenv \
72+
&& git clone --depth=1 https://github.com/cunymatthieu/tgenv.git /opt/tgenv \
73+
&& chmod -R a+rx /opt/tfenv /opt/tgenv
7074

7175
# Install kubectl using the ARG value and create symbolic link 'k'
7276
RUN wget https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl -O /usr/bin/kubectl \
@@ -107,16 +111,27 @@ RUN curl -sL https://aliyuncli.alicdn.com/aliyun-cli-linux-${ALIYUN_VERSION}-amd
107111
RUN tfenv install ${TERRAFORM_VERSION} \
108112
&& tfenv use ${TERRAFORM_VERSION} \
109113
&& tgenv install ${TERRAGRUNT_VERSION} \
114+
&& chmod -R a+rx /opt/tfenv /opt/tgenv \
110115
&& terraform --version \
111116
&& terragrunt --version
112117

113-
RUN groupadd user && groupadd guide \
114-
&& useradd -m -u ${USER_ID} -g user -G guide -s /bin/bash user
118+
# Ensure ubuntu user exists with correct uid/gid and has home directory
119+
RUN usermod -u ${USER_ID} -s /bin/bash ubuntu \
120+
&& groupmod -g ${GROUP_ID} ubuntu \
121+
&& mkdir -p /home/ubuntu \
122+
&& chown -R ubuntu:ubuntu /home/ubuntu
123+
124+
# Ensure all tools accessible to ubuntu user
125+
RUN chmod -R a+rx /opt/tfenv /opt/tgenv \
126+
&& chmod a+rx /usr/bin/kubectl /usr/local/bin/helm /usr/local/bin/hcloud \
127+
&& chmod a+rx /usr/local/bin/civo /usr/local/bin/aliyun
115128

116129
WORKDIR /
117130
RUN rm -rf /tmp/downloads
118131

119132
RUN echo 'echo "Shortcut aliases available: k (kubectl), h (helm)"' >> /etc/bash.bashrc \
120133
&& echo 'echo "Cloud CLIs available: aws, gcloud, hcloud, civo, az, aliyun"' >> /etc/bash.bashrc
121134

135+
USER ubuntu
136+
WORKDIR /home/ubuntu
122137
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)