-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (30 loc) · 1.03 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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