-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Dockerfile * feat: Docker compose env variables * docs: Added how to add env variables * fix: Controller error * docs: Added command to run application from terminal * feat: modified dockerfile * added variables to env file * modified docker workflow with new Dockerfile * Modififed Dockerfile and Dockercompose * fix: removed db call * format: readme * build java app in container
- Loading branch information
1 parent
a25217d
commit b8f3f80
Showing
9 changed files
with
166 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
POSTGRES_USER=blueprint_admin_backend | ||
POSTGRES_PASSWORD=postgres | ||
POSTGRES_DB=postgres | ||
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/postgres | ||
SPRING_DATASOURCE_USERNAME=blueprint_admin_backend | ||
SPRING_DATASOURCE_PASSWORD=postgres | ||
SPRING_PROFILES_ACTIVE=dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
FROM gradle:8.7.0-jdk17 AS build | ||
COPY --chown=gradle:gradle . /home/gradle/src | ||
WORKDIR /home/gradle/src | ||
RUN gradle build --no-daemon -x test | ||
FROM gradle:8.5-jdk17 AS builder | ||
|
||
FROM openjdk:8-jre-slim | ||
WORKDIR /app | ||
COPY build.gradle settings.gradle ./ | ||
COPY src ./src | ||
RUN gradle clean build --no-daemon | ||
|
||
FROM openjdk:17 | ||
WORKDIR /app | ||
COPY --from=builder /app/build/libs/*.jar app.jar | ||
EXPOSE 8080 | ||
|
||
RUN mkdir /app | ||
|
||
COPY --from=build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar | ||
|
||
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/spring-boot-application.jar"] | ||
ENTRYPOINT ["java", "-jar", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
services: | ||
blueprint_admin_backend: | ||
env_file: ".env" | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
environment: | ||
- DATABASE_URL=jdbc:postgresql://postgres:5432/${POSTGRES_DB} | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
ports: | ||
- '8080:8080' | ||
depends_on: | ||
- postgres | ||
|
||
postgres: | ||
env_file: ".env" | ||
image: postgres:latest | ||
restart: always | ||
environment: | ||
- POSTGRES_USER=${POSTGRES_USER} | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
logging: | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- ./postgres-data:/var/lib/postgresql/data | ||
- ./initdb_prod:/docker-entrypoint-initdb.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
-- Create roles table | ||
CREATE TABLE roles ( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY NOT NULL, | ||
name VARCHAR(255) NOT NULL, | ||
PRIMARY key(id) | ||
); | ||
|
||
-- Insert roles into roles table | ||
INSERT INTO roles (name) VALUES | ||
('E-BOARD'), | ||
('TEAM_LEAD'), | ||
('DEVELOPER'), | ||
('TECH_TEAM'), | ||
('PROJECT_MANAGER'); | ||
|
||
-- Create members table | ||
CREATE TABLE members ( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY, | ||
team_id BIGINT, | ||
name VARCHAR(255) NOT NULL, | ||
username VARCHAR(255) NOT NULL, | ||
email VARCHAR(255) UNIQUE, | ||
password VARCHAR(255) NOT NULL, | ||
is_active BOOLEAN, | ||
date_joined TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
-- Create organizations table | ||
CREATE TABLE organizations ( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY NOT NULL, | ||
name VARCHAR(255) NOT NULL, | ||
team_lead_id BIGINT, | ||
project_manager_id BIGINT, | ||
PRIMARY KEY (id), | ||
FOREIGN KEY (team_lead_id) REFERENCES members(id), | ||
FOREIGN KEY (project_manager_id) REFERENCES members(id) | ||
); | ||
|
||
-- Create teams table | ||
CREATE TABLE teams ( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY NOT NULL, | ||
organization_id BIGINT NOT NULL, | ||
name VARCHAR(255), | ||
team_lead_id BIGINT, | ||
project_manager_id BIGINT, | ||
designer_id BIGINT, | ||
date_created TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
PRIMARY KEY (id), | ||
FOREIGN KEY (organization_id) REFERENCES organizations(id), | ||
FOREIGN KEY (team_lead_id) REFERENCES members(id), | ||
FOREIGN KEY (project_manager_id) REFERENCES members(id), | ||
FOREIGN KEY (designer_id) REFERENCES members(id) | ||
); | ||
|
||
-- Create member_roles table (to handle many-to-many relationship between members and roles) | ||
CREATE TABLE member_roles ( | ||
member_id BIGINT NOT NULL, | ||
role_id BIGINT NOT NULL, | ||
PRIMARY KEY (member_id, role_id), | ||
FOREIGN KEY (member_id) REFERENCES members(id), | ||
FOREIGN KEY (role_id) REFERENCES roles(id) | ||
); | ||
|
||
--Create blogs table | ||
CREATE TABLE blogs ( | ||
id BIGINT GENERATED ALWAYS AS IDENTITY, | ||
author VARCHAR(255) NOT NULL, | ||
title VARCHAR(255) NOT NULL, | ||
date_created TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
ALTER TABLE members | ||
ADD CONSTRAINT fk_team_id FOREIGN KEY (team_id) REFERENCES teams(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters