From 949f4c09643833f0e543d9401c12f419a35c2f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EC=A2=85=ED=98=84?= <81402081+dagreatjh359@users.noreply.github.com> Date: Sat, 18 Nov 2023 16:47:27 +0900 Subject: [PATCH 1/3] Add files via upload --- Dockerfile.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile.txt diff --git a/Dockerfile.txt b/Dockerfile.txt new file mode 100644 index 00000000..0b41cfca --- /dev/null +++ b/Dockerfile.txt @@ -0,0 +1,29 @@ +# Docker multi-stage build + +# 1. Building the App with Maven +FROM maven:3-jdk-11 + +ADD . /springbootvuejs +WORKDIR /springbootvuejs + +# Just echo so we can see, if everything is there :) +RUN ls -l + +# Run Maven build +RUN mvn clean install + + +# Just using the build artifact and then removing the build-container +FROM openjdk:17.0.2-jdk + +MAINTAINER Jonas Hecht + +VOLUME /tmp + +# Add Spring Boot app.jar to Container +COPY --from=0 "/springbootvuejs/backend/target/backend-0.0.1-SNAPSHOT.jar" app.jar + +ENV JAVA_OPTS="" + +# Fire up our Spring Boot app by default +ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] \ No newline at end of file From 1033f43afc14dc58158d6c26942de20f1ad57c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EC=A2=85=ED=98=84?= <81402081+dagreatjh359@users.noreply.github.com> Date: Sat, 18 Nov 2023 17:13:01 +0900 Subject: [PATCH 2/3] Add files via upload --- Dockerfile.txt | 56 ++++++++++++++++++++++----------------------- azure-pipelines.yml | 39 +++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 28 deletions(-) create mode 100644 azure-pipelines.yml diff --git a/Dockerfile.txt b/Dockerfile.txt index 0b41cfca..88e7d2ec 100644 --- a/Dockerfile.txt +++ b/Dockerfile.txt @@ -1,29 +1,29 @@ -# Docker multi-stage build - -# 1. Building the App with Maven -FROM maven:3-jdk-11 - -ADD . /springbootvuejs -WORKDIR /springbootvuejs - -# Just echo so we can see, if everything is there :) -RUN ls -l - -# Run Maven build -RUN mvn clean install - - -# Just using the build artifact and then removing the build-container -FROM openjdk:17.0.2-jdk - -MAINTAINER Jonas Hecht - -VOLUME /tmp - -# Add Spring Boot app.jar to Container -COPY --from=0 "/springbootvuejs/backend/target/backend-0.0.1-SNAPSHOT.jar" app.jar - -ENV JAVA_OPTS="" - -# Fire up our Spring Boot app by default +# Docker multi-stage build + +# 1. Building the App with Maven +FROM maven:3-jdk-11 + +ADD . /springbootvuejs +WORKDIR /springbootvuejs + +# Just echo so we can see, if everything is there :) +RUN ls -l + +# Run Maven build +RUN mvn clean install + + +# Just using the build artifact and then removing the build-container +FROM openjdk:17.0.2-jdk + +MAINTAINER Jonas Hecht + +VOLUME /tmp + +# Add Spring Boot app.jar to Container +COPY --from=0 "/springbootvuejs/backend/target/backend-0.0.1-SNAPSHOT.jar" app.jar + +ENV JAVA_OPTS="" + +# Fire up our Spring Boot app by default ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..6105d6ed --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,39 @@ +# Docker +# Build and push an image to Azure Container Registry +# https://docs.microsoft.com/azure/devops/pipelines/languages/docker + +trigger: +- vue-cli-v2-webpack-v3 + +resources: +- repo: self + +variables: + # Container registry service connection established during pipeline creation + dockerRegistryServiceConnection: '1a082f41-08de-470a-9c82-3822b1fb153d' + imageRepository: 'dagreatjhspringbootvuejs' + containerRegistry: 'igmcr.azurecr.io' + dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' + tag: '$(Build.BuildId)' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build and push stage + jobs: + - job: Build + displayName: Build + pool: + vmImage: $(vmImageName) + steps: + - task: Docker@2 + displayName: Build and push an image to container registry + inputs: + command: buildAndPush + repository: $(imageRepository) + dockerfile: $(dockerfilePath) + containerRegistry: $(dockerRegistryServiceConnection) + tags: | + $(tag) From de014a444d579aa66f04cdde384b4ce72ac22477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EC=A2=85=ED=98=84?= <81402081+dagreatjh359@users.noreply.github.com> Date: Sat, 18 Nov 2023 17:14:53 +0900 Subject: [PATCH 3/3] Update azure-pipelines.yml --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6105d6ed..f5572a37 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -13,7 +13,7 @@ variables: dockerRegistryServiceConnection: '1a082f41-08de-470a-9c82-3822b1fb153d' imageRepository: 'dagreatjhspringbootvuejs' containerRegistry: 'igmcr.azurecr.io' - dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' + dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile.txt' tag: '$(Build.BuildId)' # Agent VM image name