Skip to content

Commit a5f4dd0

Browse files
added possibility to push image to the registry
1 parent ca718e7 commit a5f4dd0

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

.github/workflows/docker-image.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,52 @@
1-
name: Docker Image CI
1+
name: Charge Point Simulator image release
22

33
on:
44
push:
55
branches: [ "master" ]
66
pull_request:
77
branches: [ "master" ]
88

9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
913
jobs:
1014

1115
build:
1216

1317
runs-on: ubuntu-latest
1418

1519
steps:
16-
- uses: actions/checkout@v3
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
1730
- name: Set up JDK 17
1831
uses: actions/setup-java@v1
1932
with:
2033
java-version: '17'
2134
distribution: 'adopt'
2235
cache: maven
36+
2337
- name: Build with Maven
2438
run: mvn clean install
25-
- name: Build the Docker image
26-
run: docker build . --file Dockerfile --tag ocpp-charge-point-emulator-cli:$(date +%s)
39+
40+
- name: Extract metadata (tags, labels) for Docker
41+
id: meta
42+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
46+
- name: Build and push Docker image
47+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
48+
with:
49+
context: .
50+
push: true
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)