From c583369eef638ee9e6fcdafe8ef658c14f7ddd30 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 13 Apr 2024 19:57:57 +0800 Subject: [PATCH 1/2] alpine-ansible-lint: rewrite --- oci/base/alpine-ansible-lint/Dockerfile | 34 ++++------------------ oci/base/alpine-ansible-lint/entrypoint.sh | 5 +++- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/oci/base/alpine-ansible-lint/Dockerfile b/oci/base/alpine-ansible-lint/Dockerfile index 850a08e..51f4e23 100644 --- a/oci/base/alpine-ansible-lint/Dockerfile +++ b/oci/base/alpine-ansible-lint/Dockerfile @@ -1,34 +1,12 @@ -FROM alpine:3.18.3 -LABEL maintainer="Haitao Pan " - -ARG GLIBC_VERSION=2.34-r0 - -# install glibc compatibility for alpine -RUN apk add --update --no-cache curl binutils \ - && curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \ - && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk \ - && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk \ - && curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-i18n-${GLIBC_VERSION}.apk \ - && apk add --no-cache --force-overwrite \ - glibc-${GLIBC_VERSION}.apk \ - glibc-bin-${GLIBC_VERSION}.apk \ - glibc-i18n-${GLIBC_VERSION}.apk \ - && apk fix --force-overwrite alpine-baselayout-data \ - && /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 \ - && rm -rf glibc-*.apk \ - && rm -rf /var/cache/apk/* +FROM alpine:latest # Install system dependencies -RUN apk add --no-cache bash git python3 py3-pip jq \ - && pip3 install --upgrade pip \ - && pip3 install hvac jinja2 ansible ansible-lint \ - && ansible-galaxy collection install community.hashi_vault +RUN apk add --no-cache bash git python3 py3-pip jq && \ + pip3 install --upgrade pip && \ + pip3 install hvac jinja2 ansible ansible-lint && \ + ansible-galaxy collection install community.hashi_vault -# Set work directory -WORKDIR /src - -ADD entrypoint.sh /entrypoint.sh +COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] - CMD ["/bin/bash"] diff --git a/oci/base/alpine-ansible-lint/entrypoint.sh b/oci/base/alpine-ansible-lint/entrypoint.sh index 9e0b106..3979211 100755 --- a/oci/base/alpine-ansible-lint/entrypoint.sh +++ b/oci/base/alpine-ansible-lint/entrypoint.sh @@ -1,5 +1,8 @@ #!/bin/sh # required by Jenkins Docker plugin: https://github.com/docker-library/official-images#consistency -set -x +# Print a message +echo "Ansible Docker container is ready to run playbooks..." + +# Execute the command passed to the Docker container exec "$@" From 4bc2fc2d7ec0f0f0bdce2037e02baf2a343b35dc Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 27 Apr 2024 15:36:44 +0800 Subject: [PATCH 2/2] alpine-eslint/Dockerfile: update --- .../alpine-code-lint/Dockerfile | 55 ------------------- oci/base/alpine-eslint/Dockerfile | 29 ++++++---- 2 files changed, 19 insertions(+), 65 deletions(-) delete mode 100644 oci/base/alpine-ansible-lint/alpine-code-lint/Dockerfile diff --git a/oci/base/alpine-ansible-lint/alpine-code-lint/Dockerfile b/oci/base/alpine-ansible-lint/alpine-code-lint/Dockerfile deleted file mode 100644 index 3e682c8..0000000 --- a/oci/base/alpine-ansible-lint/alpine-code-lint/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -# Stage 1: Build environment -FROM alpine:3.12 as builder - -# Install build dependencies -RUN apk add --no-cache \ - git \ - curl \ - python3 \ - python3-dev \ - py3-pip \ - go \ - nodejs \ - npm \ - yaml-dev \ - libffi-dev \ - gcc \ - musl-dev - -# Install pip and Ansible -RUN pip3 install --upgrade pip -RUN pip3 install ansible ansible-lint - -# Set up Go, install Go dependencies -RUN go get -u golang.org/x/lint/golint - -# Install yamllint -RUN pip3 install yamllint - -# Set up Node.js and npm, install eslint and React plugin -RUN npm install -g eslint eslint-plugin-react - -# Stage 2: Final image -FROM alpine:3.12 - -# Copy necessary files from the builder stage -COPY --from=builder /usr/bin/python3 /usr/bin/python3 -COPY --from=builder /usr/lib/python3.8 /usr/lib/python3.8 -COPY --from=builder /usr/bin/go /usr/bin/go -COPY --from=builder /root/go /root/go -COPY --from=builder /usr/bin/node /usr/bin/node -COPY --from=builder /usr/lib/node_modules /usr/lib/node_modules - -# Create symbolic links for python and pip -RUN ln -s /usr/bin/python3 /usr/bin/python -RUN ln -s /usr/bin/python3 /usr/bin/pip - -# Ensure the tools are in the PATH -ENV PATH="/root/go/bin:/usr/lib/node_modules/.bin:${PATH}" - -# Set work directory -WORKDIR /src - -# Define an entrypoint -ENTRYPOINT ["/bin/sh"] - diff --git a/oci/base/alpine-eslint/Dockerfile b/oci/base/alpine-eslint/Dockerfile index a675da4..161090a 100644 --- a/oci/base/alpine-eslint/Dockerfile +++ b/oci/base/alpine-eslint/Dockerfile @@ -1,15 +1,24 @@ -FROM alpine:3.12 +FROM node:lts-alpine -# Install Node.js and npm -RUN apk add --no-cache \ - nodejs \ - npm +# Install bash, git, and curl +RUN apk add --no-cache bash git curl && \ + npm install -g eslint && \ + npm install -g next && \ + npm install -g jest && \ + npm install -g ts-node && \ + npm install -g typescript && \ + npm install -g next-translate && \ + npm install -g next-translate-plugin -# Install eslint -RUN npm install -g eslint +# Install gitleaks using binary installation +RUN wget https://mirrors.onwalk.net/tools/gitleaks_8.2.4_linux_x64.tar.gz \ + && tar -xf gitleaks_8.2.4_linux_x64.tar.gz \ + && mv gitleaks /usr/bin/ \ + && rm gitleaks_8.2.4_linux_x64.tar.gz -# Set work directory +# Set the working directory WORKDIR /src -# Define an entrypoint -ENTRYPOINT ["eslint"] +ENTRYPOINT ["/bin/bash"] +# Define the default command to start bash +CMD ["/bin/bash"]