Skip to content

Commit

Permalink
Upgrade to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
lr101 committed Jul 24, 2024
1 parent 1755996 commit ac15bf0
Show file tree
Hide file tree
Showing 94 changed files with 1,372 additions and 2,026 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docker Build Test

on:
push:
branches-ignore:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

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

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
46 changes: 0 additions & 46 deletions .github/workflows/maven-publish.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Docker Build

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install xmlstarlet
run: sudo apt-get install -y xmlstarlet

- name: Extract version from pom.xml
id: extract_version
run: |
VERSION=$(xmlstarlet sel -t -v "/_:project/_:version" pom.xml)
echo "VERSION=$VERSION"
echo "::set-output name=version::$VERSION"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

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

- name: Build and Push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: lrprojects/tempserver:${{ steps.extract_version.outputs.version }}
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#Maven Build
FROM maven:3.8.3-openjdk-17-slim AS builder
COPY pom.xml /app/
COPY src /app/src
ENV DB_USER=postgres
ENV DB_PASSWORD=postgres
ENV DATASOURCE_URL=jdbc:postgresql://127.0.0.1:5432/postgres
RUN --mount=type=cache,target=/root/.m2 mvn -f /app/pom.xml clean package -DskipTests
COPY pom.xml /tmp/pom.xml
WORKDIR /tmp
RUN mvn -B -f /tmp/pom.xml dependency:resolve
COPY src /tmp/src
RUN mvn clean install

#Run
FROM openjdk:17-jdk-slim
COPY --from=builder /app/target/SpringServer-1.jar app.jar
WORKDIR /app
COPY --from=build /tmp/target/*jar /app/app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:
temp-server:
container_name: temp-server
build: .
restart: unless-stopped
ports:
- 8081:8081
env_file:
- ./.env
environment:
DB_HOST: db
EMAIL: lr.dev.projects@gmail.com

# ---- Edit to change default: ----
# PORT: 8081

# ---- From .env file: -------
# POSTGRES_PASSWORD
# POSTGRES_USER
# POSTGRES_DB
# EMAIL_PASSWORD
# SECRET
depends_on:
- db
networks:
- net
db:
image: postgres:16
restart: unless-stopped
container_name: stick-it-db
ports:
- 5433:5432
volumes:
- ./postgres-data:/var/lib/postgresql/data
- ./backup:/backup
env_file:
- ./.env
networks:
- net

networks:
net:
name: "stick-it-network"
52 changes: 52 additions & 0 deletions openapi/methods/categories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
get:
summary: Get all sensor categories
operationId: getAllSensorCategories
tags:
- Sensor Categories
responses:
'200':
description: A list of sensor categories
content:
application/json:
schema:
type: array
items:
$ref: '../schemas/categoryDto.yaml'
put:
summary: Update a sensor category
operationId: updateSensorCategory
tags:
- Sensor Categories
requestBody:
description: The sensor category to update
required: true
content:
application/json:
schema:
$ref: '../schemas/categoryDto.yaml'
responses:
'200':
description: The updated sensor category
content:
application/json:
schema:
$ref: '../schemas/categoryDto.yaml'
post:
summary: Create a new sensor category
operationId: createSensorCategory
tags:
- Sensor Categories
requestBody:
description: The sensor category to create
required: true
content:
application/json:
schema:
$ref: '../schemas/categoryDto.yaml'
responses:
'200':
description: The created sensor category
content:
application/json:
schema:
$ref: '../schemas/categoryDto.yaml'
36 changes: 36 additions & 0 deletions openapi/methods/categoriesById.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
get:
summary: Get a sensor category by ID
operationId: getSensorCategoryById
tags:
- Sensor Categories
parameters:
- name: categoryId
in: path
required: true
description: The ID of the sensor category to retrieve
schema:
type: integer
format: int64
responses:
'200':
description: The sensor category with the specified ID
content:
application/json:
schema:
$ref: '../schemas/categoryDto.yaml'
delete:
summary: Delete a sensor category by ID
operationId: deleteSensorCategory
tags:
- Sensor Categories
parameters:
- name: categoryId
in: path
required: true
description: The ID of the sensor category to delete
schema:
type: integer
format: int64
responses:
'204':
description: No content, category deleted successfully
33 changes: 33 additions & 0 deletions openapi/methods/sensorTypes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
get:
summary: Get all sensor types
operationId: getSensorTypes
tags:
- Sensor Types
responses:
'200':
description: A list of sensor types
content:
application/json:
schema:
type: array
items:
$ref: '../schemas/typeDto.yaml'
post:
summary: Create a new sensor type
operationId: postSensorType
tags:
- Sensor Types
requestBody:
description: The sensor type to create
required: true
content:
application/json:
schema:
$ref: '../schemas/typeDto.yaml'
responses:
'200':
description: The created sensor type
content:
application/json:
schema:
$ref: '../schemas/typeDto.yaml'
43 changes: 43 additions & 0 deletions openapi/methods/sensorTypesById.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
get:
summary: Get a sensor type by ID
operationId: getSensorTypeById
tags:
- Sensor Types
parameters:
- $ref: '../parameters/id.yaml'
responses:
'200':
description: The sensor type with the specified ID
content:
application/json:
schema:
$ref: '../schemas/typeDto.yaml'
put:
summary: Update a sensor type
operationId: putSensorType
tags:
- Sensor Types
requestBody:
description: The sensor type to update
required: true
content:
application/json:
schema:
$ref: '../schemas/typeDto.yaml'
responses:
'200':
description: The updated sensor type
content:
application/json:
schema:
$ref: '../schemas/typeDto.yaml'
delete:
summary: Delete a sensor type by ID
operationId: deleteSensorType
tags:
- Sensor Types
parameters:
- $ref: '../parameters/sensorTypeId.yaml'
responses:
'204':
description: No content, sensor type deleted successfully
34 changes: 34 additions & 0 deletions openapi/methods/sensors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
get:
summary: Get all sensors
operationId: getSensors
tags:
- Sensors
responses:
'200':
description: A list of sensors
content:
application/json:
schema:
type: array
items:
$ref: '../schemas/sensorDto.yaml'

post:
summary: Create a new sensor
operationId: postSensor
tags:
- Sensors
requestBody:
description: The sensor to create
required: true
content:
application/json:
schema:
$ref: '../schemas/sensorDto.yaml'
responses:
'200':
description: The created sensor
content:
application/json:
schema:
$ref: '../schemas/sensorDto.yaml'
Loading

0 comments on commit ac15bf0

Please sign in to comment.