Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
fail-fast: false
matrix:
image: [ 'server', 'ui' ]
environment: ['qa', 'prod']
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -72,35 +73,36 @@ jobs:
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build QA ${{ matrix.image }} Docker image
- name: Building ${{ matrix.environment }} ${{ matrix.image }} Docker image
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REPOSITORY: "memefactory"
run: |
echo "Building on ${GITHUB_REF} branch"
DOCKER_BUILDKIT=1 docker build --build-arg BUILD_ENV=qa -t ${{ matrix.image }}:${{ github.sha }} -f docker-builds/${{ matrix.image }}/Dockerfile .
DOCKER_BUILDKIT=1 docker build --build-arg BUILD_ENV=${{ matrix.environment }} -t ${{ matrix.image }}:${{ github.sha }}-${{ matrix.environment }} -t ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:latest-${{ matrix.environment }} -t ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:${{ github.sha }}-${{ matrix.environment }} -f docker-builds/${{ matrix.image }}/Dockerfile .
echo "Successfully built docker image"

- name: Run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner for ${{ matrix.environment }} ${{ matrix.image }} Docker image
uses: aquasecurity/trivy-action@master
with:
image-ref: '${{ matrix.image }}:${{ github.sha }}'
image-ref: '${{ matrix.image }}:${{ github.sha }}-${{ matrix.environment }}'
format: 'table'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL'

- name: Push QA docker images
- name: Push docker images
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
ECR_REPOSITORY: "memefactory"
run: |
echo "Pushing docker images"
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then
echo "On the default branch will push to the registry with latest and ${{ github.sha }} tags"
docker tag ${{ matrix.image }}:${{ github.sha }} ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:${{ github.sha }}
docker tag ${{ matrix.image }}:${{ github.sha }} ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:latest
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:${{ github.sha }}
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:latest
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:${{ github.sha }}-prod
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:latest-prod
else
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:${{ github.sha }}-qa
docker push ${ECR_REGISTRY}/${ECR_REPOSITORY}-${{matrix.image}}:latest-qa
fi
2 changes: 1 addition & 1 deletion docker-builds/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:11.14.0-stretch AS build_stage
ARG BUILD_ENV=qa
ARG BUILD_ENV=prod
ENV BUILD_ENV=${BUILD_ENV}
ENV MEMEFACTORY_ENV=${BUILD_ENV}
ENV SMART_CONTRACTS=./src/memefactory/shared/smart_contracts_${BUILD_ENV}.cljs
Expand Down
7 changes: 3 additions & 4 deletions docker-builds/ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

FROM node:11.14.0-stretch AS build_stage
# FROM node:latest AS build_stage
ARG build_environment="qa"
ARG BUILD_ENV=

COPY . /build/
WORKDIR /build

ENV BUILD_ENV=$build_environment
ENV MEMEFACTORY_ENV=$build_environment
ENV BUILD_ENV=${BUILD_ENV}
ENV MEMEFACTORY_ENV=${BUILD_ENV}
ENV SMART_CONTRACTS="./src/memefactory/shared/smart_contracts_${BUILD_ENV}.cljs"
ENV SMART_CONTRACTS_BUILD_PATH=./resources/public/contracts/build/

Expand Down