Merge pull request #32 from svc-design/ci-runner-alpine-ansible-lint
Ci runner alpine ansible lint
This commit is contained in:
commit
4ac507abe5
@ -1,34 +1,12 @@
|
||||
FROM alpine:3.18.3
|
||||
LABEL maintainer="Haitao Pan <manbuzhe2009@qq.com>"
|
||||
|
||||
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"]
|
||||
|
||||
@ -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"]
|
||||
|
||||
@ -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 "$@"
|
||||
|
||||
@ -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"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user