Skip to content

Commit 77f0ee2

Browse files
committed
build: update Dockerfile
1 parent 1008395 commit 77f0ee2

File tree

1 file changed

+66
-106
lines changed

1 file changed

+66
-106
lines changed

Dockerfile

Lines changed: 66 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,70 @@
1-
FROM --platform=$BUILDPLATFORM public.ecr.aws/ubuntu/ubuntu:24.10_stable
2-
3-
4-
ARG TARGETARCH
5-
ENV DEBIAN_FRONTEND=noninteractive
6-
7-
ARG AWSCLI_VERSION=latest
8-
ARG TFCLI_VERSION=latest
9-
ARG TGCLI_VERSION=latest
10-
11-
ENV GOROOT=/opt/go
12-
ENV GOPATH=/root/.go
13-
14-
COPY --from=golang:1.21-bullseye /usr/local/go/ /usr/local/go/
15-
16-
COPY requirements.txt /tmp/requirements.txt
17-
18-
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
19-
20-
# Install apt repositories
21-
RUN apt-get update -y; \
22-
apt-get upgrade -y; \
23-
apt-get --no-install-recommends install -y \
24-
ca-certificates \
25-
wget \
26-
curl \
27-
git \
28-
jq \
29-
vim \
30-
unzip \
31-
python3 \
32-
python3-pip \
33-
zip \
34-
golang-go \
35-
zsh \
36-
dnsutils \
37-
tar \
38-
zsh \
39-
python3.12-venv \
40-
openssh-client \
41-
gzip; \
42-
apt-get clean; \
43-
rm -rf /var/lib/apt/lists/*
44-
45-
RUN wget --progress=dot:giga https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true
46-
47-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
48-
apt-get install -y nodejs && \
49-
node -v && npm -v
50-
51-
RUN mkdir -p /root/.ssh /opt/go
52-
COPY root/.zshrc /root/.zshrc
53-
COPY root/dbxcli.sh /tmp/dbxcli.sh
54-
55-
RUN python3 -m venv /root/venv
56-
RUN /root/venv/bin/pip3 install --no-cache-dir -r /tmp/requirements.txt
57-
RUN /tmp/dbxcli.sh
1+
# Use Rocky Linux as the base image
2+
FROM rockylinux:latest
3+
4+
# Set environment variables
5+
ENV PYTHON_VERSION=3.12.0 \
6+
GO_VERSION=1.21.1 \
7+
TERRAFORM_VERSION=1.5.7 \
8+
TERRAGRUNT_VERSION=0.50.3 \
9+
TFLINT_VERSION=0.48.0
10+
11+
# Update system and install dependencies
12+
RUN dnf update -y && \
13+
dnf groupinstall -y "Development Tools" && \
14+
dnf install -y gcc gcc-c++ make wget curl unzip tar git libffi-devel bzip2 bzip2-devel zlib-devel xz-devel ansible && \
15+
dnf clean all
16+
17+
# Install Python 3.12
18+
#RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz && \
19+
# tar xvf Python-$PYTHON_VERSION.tgz && \
20+
# cd Python-$PYTHON_VERSION && \
21+
# ./configure --enable-optimizations && \
22+
# make -j$(nproc) && \
23+
# make altinstall && \
24+
# cd .. && \
25+
# rm -rf Python-$PYTHON_VERSION Python-$PYTHON_VERSION.tgz
26+
27+
# Install Python libraries
28+
#RUN pip3.12 install --upgrade pip && \
29+
# pip3.12 install boto3 requests
30+
31+
# Install Go (Golang)
32+
#RUN ARCH=$(uname -m) && \
33+
# if [ "$ARCH" == "x86_64" ]; then GO_ARCH="amd64"; elif [ "$ARCH" == "aarch64" ]; then GO_ARCH="arm64"; else exit 1; fi && \
34+
# wget https://go.dev/dl/go$GO_VERSION.linux-$GO_ARCH.tar.gz && \
35+
# tar -C /usr/local -xzf go$GO_VERSION.linux-$GO_ARCH.tar.gz && \
36+
# rm -f go$GO_VERSION.linux-$GO_ARCH.tar.gz && \
37+
# echo "export PATH=\$PATH:/usr/local/go/bin" >> /etc/profile
38+
39+
# Install hcl2json
40+
#RUN /usr/local/go/bin/go install github.com/tmccombs/hcl2json@latest && \
41+
# mv /root/go/bin/hcl2json /usr/local/bin/
5842

5943
# Install Terraform
60-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi ;\
61-
VERSION="$( curl -LsS https://releases.hashicorp.com/terraform/ | grep -Eo '/[.0-9]+/' | grep -Eo '[.0-9]+' | sort -V | tail -1 )" ; \
62-
for i in {1..5}; do curl -LsS \
63-
https://releases.hashicorp.com/terraform/${VERSION}/terraform_${VERSION}_linux_${ARCHITECTURE}.zip -o ./terraform.zip \
64-
&& break || sleep 15; \
65-
done ; \
66-
unzip ./terraform.zip ; \
67-
rm -f ./terraform.zip ; \
68-
chmod +x ./terraform ; \
69-
mv ./terraform /usr/bin/terraform
70-
44+
#RUN ARCH=$(uname -m) && \
45+
# if [ "$ARCH" == "x86_64" ]; then GO_ARCH="amd64"; elif [ "$ARCH" == "aarch64" ]; then GO_ARCH="arm64"; else exit 1; fi && \
46+
# wget https://releases.hashicorp.com/terraform/$TERRAFORM_VERSION/terraform_$TERRAFORM_VERSION_linux_$GO_ARCH.zip && \
47+
# unzip terraform_$TERRAFORM_VERSION_linux_$GO_ARCH.zip && \
48+
# mv terraform /usr/local/bin/ && \
49+
# rm -f terraform_$TERRAFORM_VERSION_linux_$GO_ARCH.zip
7150

7251
# Install Terragrunt
73-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi ;\
74-
VERSION="$( curl -LsS https://api.github.com/repos/gruntwork-io/terragrunt/releases/latest | jq -r .name )" ; \
75-
for i in {1..5}; do curl -LsS \
76-
https://github.com/gruntwork-io/terragrunt/releases/download/${VERSION}/terragrunt_linux_${ARCHITECTURE} -o /usr/bin/terragrunt \
77-
&& break || sleep 15; \
78-
done ;\
79-
chmod +x /usr/bin/terragrunt
80-
81-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi ;\
82-
DOWNLOAD_URL=$( curl -LsS https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_${ARCHITECTURE}.zip" ) ;\
83-
for i in {1..5}; do curl -LsS "${DOWNLOAD_URL}" -o ./tflint.zip && break || sleep 15; done ;\
84-
unzip ./tflint.zip ;\
85-
rm -f ./tflint.zip ;\
86-
chmod +x ./tflint ;\
87-
mv ./tflint /usr/bin/tflint
88-
89-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi ;\
90-
DOWNLOAD_URL=$( curl -LsS https://api.github.com/repos/minamijoyo/hcledit/releases/latest | grep -o -E "https://.+?_linux_${ARCHITECTURE}.tar.gz" ) ;\
91-
for i in {1..5}; do curl -LsS "${DOWNLOAD_URL}" -o ./hcledit.tar.gz && break || sleep 15; done ;\
92-
tar -xf ./hcledit.tar.gz ;\
93-
rm -f ./hcledit.tar.gz ;\
94-
chmod +x ./hcledit ;\
95-
chown "$(id -u):$(id -g)" ./hcledit ;\
96-
mv ./hcledit /usr/bin/hcledit
97-
98-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi ;\
99-
DOWNLOAD_URL=$( curl -LsS https://api.github.com/repos/getsops/sops/releases/latest | grep -o -E "https://.+?\.linux.${ARCHITECTURE}" | head -1 ) ;\
100-
for i in {1..5}; do curl -LsS "${DOWNLOAD_URL}" -o /usr/bin/sops && break || sleep 15; done ;\
101-
chmod +x /usr/bin/sops
102-
103-
RUN if [ "${TARGETARCH}" = "linux/amd64" ]; then ARCHITECTURE=x86_64; elif [ "${TARGETARCH}" = "linux/arm64" ]; then ARCHITECTURE=aarch64; else ARCHITECTURE=x86_64; fi ;\
104-
for i in {1..5}; do curl -LsS "https://awscli.amazonaws.com/awscli-exe-linux-${ARCHITECTURE}.zip" -o /tmp/awscli.zip && break || sleep 15; done ;\
105-
mkdir -p /usr/local/awscli ;\
106-
unzip -q /tmp/awscli.zip -d /usr/local/awscli ;\
107-
/usr/local/awscli/aws/install
108-
109-
WORKDIR /workspace
110-
CMD ["/bin/zsh"]
52+
#RUN ARCH=$(uname -m) && \
53+
# if [ "$ARCH" == "x86_64" ]; then GO_ARCH="amd64"; elif [ "$ARCH" == "aarch64" ]; then GO_ARCH="arm64"; else exit 1; fi && \
54+
# wget https://github.com/gruntwork-io/terragrunt/releases/download/v$TERRAGRUNT_VERSION/terragrunt_linux_$GO_ARCH && \
55+
# mv terragrunt_linux_$GO_ARCH /usr/local/bin/terragrunt && \
56+
# chmod +x /usr/local/bin/terragrunt
57+
58+
# Install TFLint
59+
#RUN ARCH=$(uname -m) && \
60+
# if [ "$ARCH" == "x86_64" ]; then GO_ARCH="amd64"; elif [ "$ARCH" == "aarch64" ]; then GO_ARCH="arm64"; else exit 1; fi && \
61+
# wget https://github.com/terraform-linters/tflint/releases/download/v$TFLINT_VERSION/tflint_linux_$GO_ARCH.zip && \
62+
# unzip tflint_linux_$GO_ARCH.zip && \
63+
# mv tflint /usr/local/bin/ && \
64+
# rm -f tflint_linux_$GO_ARCH.zip
65+
66+
# Set PATH for Go
67+
#ENV PATH="/usr/local/go/bin:$PATH"
68+
69+
# Default command
70+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)