generated from BCDevOps/opendev-template
-
Notifications
You must be signed in to change notification settings - Fork 3
55 lines (47 loc) · 1.42 KB
/
test.yml
File metadata and controls
55 lines (47 loc) · 1.42 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Build Test Image
on:
push:
branches:
- test
paths:
- app/**
- config/**
- db/**
- eulas/**
- lib/**
- public/**
- spec/**
- swagger/**
- config.ru
- Gemfile
- Gemfile.lock
- package-lock.json
- package.json
- Rakefile
jobs:
build-and-push-image:
runs-on: ubuntu-latest
name: Build & Push Docker Image to Artifactory
environment: test
steps:
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
lfs: true
# Step 2: Login to Artifactory
- name: Login to Artifactory
run: docker login artifacts.developer.gov.bc.ca -u ${{ secrets.ARTIFACTORY_USERNAME }} -p ${{ secrets.ARTIFACTORY_PASSWORD }}
# Step 3: Build Image
- name: Build Docker Image
run: docker build -t energy-app -f ./devops/docker/app/Dockerfile .
# Step 4: Tag the Image
- name: Tag Docker Image
run: docker tag energy-app artifacts.developer.gov.bc.ca/bbfc-test/energy-app:latest
# Step 5: Push the Docker image to Artifactory
- name: Push Image to Artifactory
run: docker push artifacts.developer.gov.bc.ca/bbfc-test/energy-app:latest
# Step 6: Logout
- name: Log out from Docker
run: docker logout artifacts.developer.gov.bc.ca