Docker/-compose

This commit is contained in:
Marvin Scham
2023-06-24 23:34:13 +00:00
parent cb757035a2
commit 3a1450dade
7 changed files with 106 additions and 16 deletions

View File

@@ -10,6 +10,7 @@
- `AmazonPurchaser` - `AmazonPurchaser`
- `EbaySeller` - `EbaySeller`
- `EbayPurchaser` - `EbayPurchaser`
- Dockerfile and `docker-compose.yml`
## 0.2.0 ## 0.2.0

28
Dockerfile Normal file
View File

@@ -0,0 +1,28 @@
# Use the official maven/Java 17 image to create a build artifact.
# https://hub.docker.com/_/maven
FROM maven:3.9.1-eclipse-temurin-17 AS build
# Set the working directory in the image to /app
WORKDIR /app
# Copy the pom.xml file into the current directory (/app) in the image
COPY pom.xml .
# Download all required dependencies into one layer
RUN mvn -B dependency:go-offline
# Copy the rest of the application source code
COPY src /app/src
# Build the application
RUN mvn -B package -DskipTests
# Use OpenJDK 17 for the runtime stage of the Dockerfile
FROM openjdk:17-jdk-slim
# Copy the jar file from the build stage
COPY --from=build /app/target/easydrop-0.3.0-SNAPSHOT.jar /easydrop.jar
# Execute the application when the docker container starts.
ENTRYPOINT ["java", "-jar", "/easydrop.jar"]

View File

@@ -1,6 +1,6 @@
# EasyDrop # EasyDrop
![Version](https://img.shields.io/badge/version-0.3.0_SNAPSHOT-orange) ![Version](https://img.shields.io/badge/version-0.3.0SNAPSHOT-orange)
![Pipeline](https://gitlab.fbe-adswen.rwu.de/team1/sandbox2/badges/main/pipeline.svg) ![Pipeline](https://gitlab.fbe-adswen.rwu.de/team1/sandbox2/badges/main/pipeline.svg)
[![Coverage](https://sonar.fbe-adswen.rwu.de/api/project_badges/measure?project=de.rwu%3Aeasydrop&metric=coverage&token=sqb_2fe80aed361468170aaef32a0ff96d596456cdd1)](https://sonar.fbe-adswen.rwu.de/dashboard?id=de.rwu%3Aeasydrop) [![Coverage](https://sonar.fbe-adswen.rwu.de/api/project_badges/measure?project=de.rwu%3Aeasydrop&metric=coverage&token=sqb_2fe80aed361468170aaef32a0ff96d596456cdd1)](https://sonar.fbe-adswen.rwu.de/dashboard?id=de.rwu%3Aeasydrop)
![JAMANN](https://img.shields.io/badge/Auszahlung-Letzte%20Woche-brightgreen) ![JAMANN](https://img.shields.io/badge/Auszahlung-Letzte%20Woche-brightgreen)
@@ -13,30 +13,37 @@ Get rich quick™ with fully automated dropshipping!
![Demo Image](Docs/DemoImage.png) ![Demo Image](Docs/DemoImage.png)
## Installation ⚙ ## Installation/Usage
As the application is still in development, development software will be required along its regular execution environment. - Install Docker + Compose
- Clone this repository
- JDK 17
- Maven
- _[More/context](https://gitlab.fbe-adswen.rwu.de/team1/sandbox2/-/wikis/Projektdokumentation/Development#software)_
## Usage 🛠
Set up the required configuration files, use the corresponding demo files for orientation. Set up the required configuration files, use the corresponding demo files for orientation.
- `config/config.properties` for API authorization - `config/config.properties` for API authorization
- `products-config.json` to define product catalogues to use for dropshipping - `products-config.json` to define product catalogues to use for dropshipping
Run the following command to execute the program: Create the container
```sh ```bash
mvn compile exec:java -Dexec.mainClass="de.rwu.easydrop.Main" docker-compose build
```
Then run it!
```bash
docker-compose up
```
To run it on a fixed schedule, install a cron job, e.g.
```bash
*/30 * * * * cd /home/user/easydrop && docker-compose up -d
``` ```
## Roadmap 🏁 ## Roadmap 🏁
_Future ideas!_ - Access transaction log
## Contributing 👷‍♂️👷‍♀️ ## Contributing 👷‍♂️👷‍♀️

23
Script/Bump_Version.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# Checking if correct number of arguments are provided
if [ "$#" -ne 2 ]; then
echo "Required CLI args missing: [old_version, new_version]"
exit 1
fi
# Assigning command line arguments to variables
old_version="$1"
new_version="$2"
old_version_alt=${old_version//-/}
new_version_alt=${new_version//-/}
# Replacing old_version with new_version in README.md
sed -i "s/version-$old_version_alt-orange/version-$new_version_alt-orange/g" README.md
sed -i "s/<version>$old_version/<version>$new_version/g" pom.xml
sed -i "s/easydrop-$old_version.jar/easydrop-$new_version.jar/g" Dockerfile
sed -i "s/image: easydrop:$old_version/image: easydrop:$new_version/g" docker-compose.yml
echo "Version number updated successfully"

View File

@@ -2,6 +2,5 @@ mvn clean verify sonar:sonar -Pcoverage \
-Dsonar.projectKey=EasyDrop \ -Dsonar.projectKey=EasyDrop \
-Dsonar.projectName='EasyDrop' \ -Dsonar.projectName='EasyDrop' \
-Dsonar.host.url=http://localhost:9000 \ -Dsonar.host.url=http://localhost:9000 \
-Dsonar.token=sqp_82d35689c620c15fd1064549375e17a2a5b0b931 -Dsonar.token=sqp_82d35689c620c15fd1064549375e17a2a5b0b931 \
&& start http://localhost:9000/dashboard?id=EasyDrop
start http://localhost:9000/dashboard?id=EasyDrop

11
docker-compose.yml Normal file
View File

@@ -0,0 +1,11 @@
version: "3.8"
services:
easydrop:
container_name: easydrop
build:
context: .
dockerfile: Dockerfile
image: easydrop:0.3.0-SNAPSHOT
volumes:
- ./config:/config

21
pom.xml
View File

@@ -86,6 +86,27 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.rwu.easydrop.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>