Skip to content

Commit 90ea6b0

Browse files
committed
build iamge
1 parent b9ce8cf commit 90ea6b0

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/pr-pipeline.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: PR pipeline
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
8+
env:
9+
IMAGE_NAME: hsldevcom/hsl-map-server
10+
TEST_STAGE: tester
11+
PRODUCTION_STAGE: production
12+
13+
jobs:
14+
build-check-test-push:
15+
name: Build, check, test, push
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
clean: 'true'
22+
fetch-depth: 2
23+
24+
- name: Setup Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Build tester image
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: .
31+
load: true
32+
target: "${{ env.TEST_STAGE }}"
33+
tags: "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
34+
35+
- name: Run checks and tests inside Docker
36+
run: docker run --rm "${{ env.IMAGE_NAME }}:${{ env.TEST_STAGE }}"
37+
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v3
40+
with:
41+
username: ${{ secrets.DOCKER_USER }}
42+
password: ${{ secrets.DOCKER_AUTH }}
43+
44+
- name: Build and push production image
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
push: true
49+
target: "${{ env.PRODUCTION_STAGE }}"
50+
tags: "${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}"

0 commit comments

Comments
 (0)