Merge pull request #40 from svc-design/build-ci-image-ansible-runner

Build ci image ansible runner
This commit is contained in:
shenlan 2024-04-30 13:20:02 +08:00 committed by GitHub
commit 1ee2e6c864
2 changed files with 47 additions and 10 deletions

View File

@ -0,0 +1,28 @@
name: build images ansible-runner
on:
pull_request:
branches:
- main
paths:
- 'oci/base/alpine-ansible-lint/Dockerfile'
- '.github/workflows/build-ci-image-ansible-runer.yml'
workflow_dispatch:
branches:
- main
env:
IMAGE_REPO: "artifact.onwalk.net"
jobs:
eslint:
name: Build Docker in Docker image
uses: svc-design/actions/.github/workflows/build-images.yaml@main
with:
method: 'docker/node'
registry_addr: "harbor.onwalk.net"
dockerfile_path: 'oci/base/alpine-ansible-lint'
image_name: 'public/base/alpine-ansible-runer'
image_tag: 'latest'
secrets:
artifactory_sa: ${{ secrets.REPO_USER }}
artifactory_pw: ${{ secrets.HELM_REPO_PASSWORD }}

View File

@ -1,12 +1,21 @@
FROM alpine:latest
FROM python: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
ENV TIME_ZONE=Asia/Shanghai \
BIN_PERM=0755 \
BIN_DIR=/usr/local/bin \
HELM_FILE_URL=https://github.com/roboll/helmfile/releases/download \
HELM_FILE_VERSION=v0.139.9 \
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/bin/bash"]
RUN unlink /etc/localtime && ln -s /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
&& apt-get update -y && apt-get upgrade -y \
&& apt-get --reinstall -y install tar curl sshpass jq git vim uuid-runtime \
&& wget ${HELM_FILE_URL}/${HELM_FILE_VERSION}/helmfile_linux_amd64 -O ${BIN_DIR}/helmfile \
&& chmod ${BIN_PERM} ${BIN_DIR}/helmfile \
&& helm plugin install https://github.com/databus23/helm-diff \
&& rm -rf /var/lib/apt/lists/*
RUN pip install ansible==2.10 ansible-lint jmespath hvac jinja2 && ansible-galaxy collection install community.hashi_vault
WORKDIR /home/${USER}
CMD $@