Skip to content

Commit

Permalink
Merge pull request #2 from aldairjpalma/master
Browse files Browse the repository at this point in the history
working(kinda) woot woot
  • Loading branch information
aldairjpalma authored Dec 1, 2023
2 parents c400e0e + f7256d2 commit 850d08b
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/dockerpush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Tag Docker Image

on:
push:
branches:
- 'master'

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Environmental Variables
run: |
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: |
itswebbibi/dadbot:latest
itswebbibi/dadbot:${{ env.GIT_SHA }}
33 changes: 33 additions & 0 deletions ARJIpom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>DadBot</artifactId>
<groupId>win.biosInterweb.discordBots</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ARJI</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.22</version>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>dotenv-java</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>

</project>
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Cloning Stage
FROM alpine:3.18 AS clone

RUN apk update && apk add --no-cache git

WORKDIR /gittmp/
RUN git clone https://github.com/ARGamer36/DadBot.git
WORKDIR /gittmp/DadBot/
RUN git clone https://github.com/ARGamer36/ARJI.git
RUN mv /gittmp/DadBot/ARJIpom.xml /gittmp/DadBot/ARJI/pom.xml

#Building Stage
FROM maven:3.8.3-openjdk-17 AS build
COPY --from=clone /gittmp/DadBot/ARJI/ /tmp/DadBot/ARJI/
COPY --from=clone /gittmp/DadBot/Driver/ /tmp/DadBot/Driver/
COPY --from=clone /gittmp/DadBot/pom.xml /tmp/DadBot/pom.xml
#COPY --from=clone /gittmp/.gitmodules /tmp/.gitmodules

WORKDIR /tmp/DadBot/
RUN mvn clean package

# Run Stage
FROM openjdk:17-alpine
COPY --from=build /tmp/DadBot/Driver/target/*.jar /user/DadBot/Interweb-jar-with-dependencies.jar
RUN mv /user/DadBot/Interweb-jar-with-dependencies.jar /user/DadBot/app.jar
WORKDIR /user/DadBot/
RUN echo "$(TZ=$TZ date +'%m/%d/%Y %H:%M:%S %Z')" > buildInfo.txt
CMD ["java", "-jar", "app.jar"]
32 changes: 29 additions & 3 deletions Driver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>Driver</artifactId>

<properties>
Expand All @@ -23,6 +22,33 @@
<artifactId>ARJI</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

</dependencies>
</project>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>Interweb</finalName>
<archive>
<manifest>
<mainClass>DadBot</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 850d08b

Please sign in to comment.