Skip to content

Commit

Permalink
Added actions and docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonpoltorak committed Nov 29, 2023
1 parent 1459828 commit 494c1b4
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Test Application with Gradle

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
test-app-with-gradle:
runs-on: ubuntu-latest

services:
note-postgres:
image: postgres:alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: none
POSTGRES_DB: noteapp
ports:
- "5100:5432"
options: --name note-postgres
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
env:
SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5100/noteapp
POSTGRES_USER: postgres
POSTGRES_PASSWORD: none
POSTGRES_DB: noteapp
FRONTEND_URL: http://localhost:4200
GOOGLE_CLIENT_ID: none
GOOGLE_CLIENT_SECRET: none
with:
gradle-version: '8.2'
arguments: build
build-root-directory: note-app-backend
8 changes: 6 additions & 2 deletions corn-backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM gradle:8.2-jdk17-alpine

WORKDIR /home/note-app
WORKDIR /home/todo-app

COPY build.gradle .

COPY settings.gradle .

COPY src/ src/

RUN gradle build -x test

RUN mv build/libs/todo-app-backend-0.0.1-SNAPSHOT.jar todo-app.jar

EXPOSE 8080

ENTRYPOINT ["gradle", "bootRun"]
ENTRYPOINT ["java", "-jar", "todo-app.jar"]
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: "3.1"

services:
corn-postgres:
container_name: corn-postgres
image: postgres:alpine
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=none
- POSTGRES_DB=corn
ports:
- "5000:5432"
corn-backend:
container_name: corn-backend
image: corn-backend
depends_on:
- corn-postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=none
- POSTGRES_DB=corn
- SPRING_DATASOURCE_URL=jdbc:postgresql://corn-postgres:5432/corn
- FRONTEND_URL=corn-frontend
build:
context: corn-app-backend
dockerfile: Dockerfile
ports:
- "8080:8080"
corn-frontend:
container_name: corn-frontend
image: corn-frontend
depends_on:
- corn-backend
build:
context: corn-app-frontend
dockerfile: Dockerfile
ports:
- "4200:80"

0 comments on commit 494c1b4

Please sign in to comment.