Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added actions and docker-compose #5

Merged
merged 2 commits into from
Nov 29, 2023
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
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:
corn-postgres:
image: postgres:alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: none
POSTGRES_DB: corn
ports:
- "5000:5432"
options: --name corn-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:5000/corn
POSTGRES_USER: postgres
POSTGRES_PASSWORD: none
POSTGRES_DB: corn
FRONTEND_URL: http://localhost:4200
GOOGLE_CLIENT_ID: none
GOOGLE_CLIENT_SECRET: none
with:
gradle-version: '8.2'
arguments: build
build-root-directory: corn-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"