diff --git a/.circleci/config.yml b/.circleci/config.yml index dcbc0ff..b80b8e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: anchore: anchore/anchore-engine@1.3.0 jobs: - "fdk": + "test": docker: - image: circleci/golang:1.12.4 working_directory: ~/fdk-go @@ -22,7 +22,7 @@ jobs: git branch --set-upstream-to=origin/${CIRCLE_BRANCH} ${CIRCLE_BRANCH} fi - "go1-12-4_security_check": + "go1_stretch_security_check": executor: anchore/anchore_engine working_directory: ~/fdk-go steps: @@ -30,12 +30,31 @@ jobs: docker_layer_caching: true - checkout - run: - name: Golang 1.12.4 Stretch build + name: Golang 1 Stretch build command: | apk add bash - ./build-images.sh 1.12.4 stretch + ./build-images.sh 1 stretch - anchore/analyze_local_image: - image_name: "fnproject/golang:1.12.4-stretch fnproject/golang:1.12.4-stretch-dev" + image_name: "fnproject/go:1-stretch fnproject/go:1-stretch-dev" + timeout: '500' + policy_failure: true + policy_bundle_file_path: .circleci/.anchore/policy_bundle.json + - anchore/parse_reports + + "go1_alpine_security_check": + executor: anchore/anchore_engine + working_directory: ~/fdk-go + steps: + - setup_remote_docker: + docker_layer_caching: true + - checkout + - run: + name: Golang 1 Alpine 3.8 build + command: | + apk add bash + ./build-images.sh 1 alpine + - anchore/analyze_local_image: + image_name: "fnproject/go:1-alpine fnproject/go:1-alpine-dev" timeout: '500' policy_failure: true policy_bundle_file_path: .circleci/.anchore/policy_bundle.json @@ -45,5 +64,16 @@ workflows: version: 2 build: jobs: - - "fdk" - - "go1-12-4_security_check" + - "test" + nightly: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - master + jobs: + - "test" + - "go1_stretch_security_check" + - "go1_alpine_security_check" diff --git a/build-images.sh b/build-images.sh index f22d060..909bb3c 100755 --- a/build-images.sh +++ b/build-images.sh @@ -2,8 +2,8 @@ set -xe -goversion=${1:-"1.12.4"} +goversion=${1:-"1"} ostype=${2:-"alpine"} -pushd images/${goversion}/${ostype}/build-stage/ && docker build -t fnproject/golang:${goversion}-${ostype}-dev . && popd -pushd images/${goversion}/${ostype}/runtime/ && docker build -t fnproject/golang:${goversion}-${ostype} . && popd +pushd images/${goversion}/${ostype}/build-stage && docker build -t fnproject/go:${goversion}-${ostype}-dev . && popd +pushd images/${goversion}/${ostype}/runtime && docker build -t fnproject/go:${goversion}-${ostype} . && popd diff --git a/images/1.12.4/alpine/build-stage/Dockerfile b/images/1/alpine/build-stage/Dockerfile similarity index 77% rename from images/1.12.4/alpine/build-stage/Dockerfile rename to images/1/alpine/build-stage/Dockerfile index b641550..2930364 100644 --- a/images/1.12.4/alpine/build-stage/Dockerfile +++ b/images/1/alpine/build-stage/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.4-alpine3.8 +FROM golang:1-alpine3.8 RUN apk update && apk upgrade && \ apk add --no-cache wget curl git bzr mercurial build-base diff --git a/images/1.12.4/alpine/runtime/Dockerfile b/images/1/alpine/runtime/Dockerfile similarity index 100% rename from images/1.12.4/alpine/runtime/Dockerfile rename to images/1/alpine/runtime/Dockerfile diff --git a/images/1.12.4/stretch/build-stage/Dockerfile b/images/1/stretch/build-stage/Dockerfile similarity index 83% rename from images/1.12.4/stretch/build-stage/Dockerfile rename to images/1/stretch/build-stage/Dockerfile index 0b35ef0..9b63cac 100644 --- a/images/1.12.4/stretch/build-stage/Dockerfile +++ b/images/1/stretch/build-stage/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12.4-stretch +FROM golang:1-stretch RUN apt-get update && apt-get upgrade -qy && \ apt-get install wget curl mercurial build-essential gcc -qy && \ diff --git a/images/1.12.4/stretch/runtime/Dockerfile b/images/1/stretch/runtime/Dockerfile similarity index 100% rename from images/1.12.4/stretch/runtime/Dockerfile rename to images/1/stretch/runtime/Dockerfile diff --git a/release_images.sh b/release_images.sh new file mode 100755 index 0000000..dd60aaa --- /dev/null +++ b/release_images.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +user="fnproject" +image="go" +goversion="1" +stretch="stretch" +alpine="alpine" + + +docker push ${user}/${image}:${goversion}-${stretch} +docker push ${user}/${image}:${goversion}-${stretch}-dev + +docker push ${user}/${image}:${goversion}-${alpine} +docker push ${user}/${image}:${goversion}-${alpine}-dev