Skip to content

Cicd

Cicd #1

Workflow file for this run

name: CI Pipeline
on:
workflow_dispatch:
pull_request:
branches:
- master
env:
IMAGE_NAME: portfolio-test-image
REGISTRY: ghcr.io
jobs:
test:
name: Test Application
runs-on: ubuntu-latest
environment: testing # The Github environment to use
steps:
- name: Check out code
uses: actions/checkout@v2
#- name: create env.testing file # - Uncomment this to load testing env vars from secrets (then add --env-file .env.testing to docker run below)
#run: echo "${{ secrets.ENV_FILE_TESTING }}" > .env.testing
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:testing
load: true
target: test # Target the test build target in the Dockerfile
- name: Run Tests
run: |
docker run -d --name my_container ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}:testing