Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build-and-push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build-and-push-docker-image

on:
workflow_call:
inputs:
imageName:
required: true
type: string
imageTag:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true

jobs:
docker:
runs-on: [self-hosted, Linux, X64]
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ inputs.imageName }}:${{ inputs.imageTag }}
16 changes: 16 additions & 0 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release build & push to Docker Hub

on:
push:
branches:
- main

jobs:
release-build-push:
uses: ./.github/workflows/build-and-push-docker-image.yml
with:
imageName: drive-api
imageTag: latest
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Develop nightly build & push to Docker Hub

on:
push:
branches:
- develop

jobs:
nightly-build-push:
uses: ./.github/workflows/build-and-push-docker-image.yml
with:
imageName: drive-api
imageTag: nightly
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release build & push to Docker Hub

on:
release:
types: [published]

jobs:
release-build-push:
uses: ./.github/workflows/build-and-push-docker-image.yml
with:
imageName: drive-api
imageTag: ${{ github.event.release.tag_name }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
29 changes: 9 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
FROM amazoncorretto:21-alpine AS builder
FROM eclipse-temurin:21.0.7_6-jdk-alpine AS builder

WORKDIR /app
WORKDIR /usr/app

COPY . .

RUN ./gradlew clean :infrastructure:bootJar --no-daemon
RUN ./gradlew clean bootJar --no-daemon

FROM amazoncorretto:21-alpine
FROM eclipse-temurin:21.0.7_6-jdk-alpine

WORKDIR /app
COPY --from=builder /usr/app/build/libs/application.jar /opt/app/application.jar

RUN mkdir -p /app/storage && chmod -R 777 /app/storage
RUN addgroup -S app && adduser -S app -G app
USER app:app

COPY --from=builder /app/build/libs/application.jar app.jar
EXPOSE 80

ENV SPRING_PROFILES_ACTIVE=local
ENV KEYCLOAK_REALM=callv2
ENV KEYCLOAK_HOST=http://localhost:8090
ENV POSTGRES_HOST=localhost
ENV POSTGRES_PORT=5432
ENV POSTGRES_DATABASE=callv2
ENV POSTGRES_USERNAME=callv2
ENV POSTGRES_PASSWORD=callv2
ENV STORAGE_LOCATION=/app/storage

EXPOSE 8080

ENTRYPOINT ["sh", "-c", "java -jar /app/app.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE}"]
CMD ["sh", "-c", "java -jar /opt/app/application.jar"]
Empty file modified gradlew
100644 → 100755
Empty file.
21 changes: 21 additions & 0 deletions infrastructure/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server:
port: ${SERVER_PORT}

keycloak:
realm: callv2
host: ${KEYCLOAK_HOST}
client:
user-api:
client-id: ${KEYCLOAK_CLIENT_ID}
client-secret: ${KEYCLOAK_CLIENT_SECRET}

postgres:
host: ${POSTGRES_HOST}
port: ${POSTGRES_PORT}
database: drive
username: ${POSTGRES_USER}
password: ${POSTGRES_PASSWORD}

storage:
file-system:
location: ${STORAGE_LOCATION}
14 changes: 0 additions & 14 deletions infrastructure/src/main/resources/application-hmg.yml

This file was deleted.

3 changes: 3 additions & 0 deletions infrastructure/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
server:
port: 8080

keycloak:
realm: callv2
host: http://localhost:8090
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server:
port: 8080
port: 80
servlet:
context-path: /api
compression:
Expand Down