diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c81e3c..a504f86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,8 +40,7 @@ jobs: run: mvn package - name: Build Docker Image - run: | - docker build -t binance-telegram-bot:${{ env.VERSION }} . + run: docker build -t binance-telegram-bot:$CUSTOM_VERSION . - name: Log in to Docker Hub uses: docker/login-action@v1 diff --git a/Dockerfile b/Dockerfile index 3cc4653..5f81d3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ -# Use an official Java runtime as a parent image -FROM openjdk:11-jdk +# For Java 11 +FROM --platform=linux/amd64 adoptopenjdk:11-jre-hotspot -# Set the working directory in the container -WORKDIR /usr/src/app +# Refer to Maven build -> finalName +ARG JAR_FILE=target/*.jar -# Copy the current directory contents into the container at /usr/src/app -COPY . . +# cd /opt/app +WORKDIR /opt/app -# Build the application -RUN mvn clean install -DskipTests +# cp target/spring-boot-web.jar /opt/app/app.jar +COPY ${JAR_FILE} app.jar -# Run the jar file -ENTRYPOINT ["java", "-jar", "target/binance-telegram-bot-0.0.1-SNAPSHOT.jar"] +# java -jar /opt/app/app.jar +ENTRYPOINT ["java","-jar","app.jar"]