diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..c9b6f3f --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,42 @@ +version: 2.1 + +orbs: + aws-ecr: circleci/aws-ecr@6.1.0 + +jobs: + say-hello: + executor: aws-ecr/default + steps: + - checkout + - run: + name: "Pull docker image" + command: "docker pull nginx" + - run: + name: "Scan docker image" + command: | + sudo apt-get install wget apt-transport-https gnupg lsb-release + wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - + echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list + sudo apt-get update + sudo apt-get install trivy + sudo mkdir /imagesecreport + sudo trivy image --no-progress -format json --output /imagesecreport/scanning-report.txt nginx:latest + - store_artifacts: + path: /imagesecreport + + say-tello: + docker: + - image: cimg/base:stable + steps: + - checkout + - run: + name: "Say hello" + command: "echo Tello, World!" + +workflows: + say-hello-workflow: + jobs: + - say-hello + - say-tello: + requires: + - say-hello diff --git a/.circleci/images/Dockerfile b/.circleci/images/Dockerfile new file mode 100644 index 0000000..435a944 --- /dev/null +++ b/.circleci/images/Dockerfile @@ -0,0 +1,36 @@ +FROM node:16-alpine + +# Install packages +RUN apk update && apk add --update --no-cache \ + git \ + bash \ + curl \ + openssh \ + python3 \ + py3-pip \ + py-cryptography \ + wget \ + curl \ + tar \ + unzip \ + ca-certificates + + +RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community +RUN cd /opt && curl -sSl http://mirror.vorboss.net/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz | tar -xz +RUN apk -U add --no-cache curl; \ + curl https://downloads.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip > gradle.zip; \ + unzip gradle.zip; \ + rm gradle.zip; \ + apk del curl; \ + apk update && apk add --no-cache libstdc++ && rm -rf /var/cache/apk/* + +RUN apk --no-cache add --virtual builds-deps build-base python3 + +# Update NPM +RUN npm config set unsafe-perm true +RUN npm update -g + +# Install AWSCLI +RUN pip install --upgrade pip && \ + pip install --upgrade awscli \ No newline at end of file