Skip to content

Commit ee0d3aa

Browse files
committed
updated docker creation
1 parent eb14c0c commit ee0d3aa

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
---
22
name: "release"
33

4+
env:
5+
DOCKER_IMAGE_NAME: dedicatedcode/reitti
6+
47
on:
8+
# Trigger the action manually from the UI
9+
workflow_dispatch:
10+
# Trigger the action when a version tag is pushed
511
push:
612
branches:
713
- "*"
814
tags:
9-
- "v*"
15+
- '[0-9]+.[0-9]+.[0-9]+' # Push events to matching numeric semver tags, i.e., 1.0.0, 20.15.10
1016

1117
jobs:
1218
tagged-release:
@@ -22,14 +28,27 @@ jobs:
2228
distribution: 'temurin'
2329
cache: maven
2430
- name: Build
25-
run: mvn --batch-mode --update-snapshots package -Pdocker
31+
run: mvn --batch-mode --update-snapshots package
2632
- name: Login to Docker Hub
2733
uses: docker/login-action@v2
2834
with:
2935
username: ${{ secrets.DOCKER_HUB_USERNAME }}
3036
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
31-
- name: Build & Publish Latest Docker Image
32-
run: mvn spring-boot:build-image -Pdocker -DskipTests -Ddocker.tag=latest
37+
38+
- name: Get the tag name
39+
id: get_version
40+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
41+
- name: Build and push Landing Page Docker image
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
file: ./Dockerfile
46+
push: true
47+
tags: |
48+
${{ env.DOCKER_IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}
49+
${{ env.DOCKER_IMAGE_NAME }}:latest
50+
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_NAME }}:buildcache
51+
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE_NAME }}:buildcache,mode=max
3352
- uses: "marvinpinto/action-automatic-releases@latest"
3453
with:
3554
repo_token: "${{ secrets.GITHUB_TOKEN }}"

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LABEL org.opencontainers.image.licenses="MIT"
99
RUN addgroup -S reitti -g 1000 && adduser -S reitti -u 1000 -G reitti
1010

1111
# Set environment variables
12-
ENV SPRING_PROFILES_ACTIVE=prod
12+
ENV SPRING_PROFILES_ACTIVE=docker
1313
ENV APP_HOME=/app
1414

1515
# Create application directory

docker-run.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)