Search code examples
docker-composeazure-devopsdockerfileazure-pipelinesdockerhub

Dockerfile+spring boot+mysql+dockerhub+azure devop


I'm beginner in Docker and Azure Devops. I'm have a basic application with spring boot and mysql data base, and I have a student account in Microsoft Azure. I wrote a dockerfile and docker-compose for my application spring boot and push my docker image to dockerHub, then now I don't know what is the next thing that I should do, should I use multistage build? or write my pipeline in azure and do the CI?

FROM openjdk:14-jdk-alpine  ## définir l'image source

ARG JAR_FILE=*.jar

COPY ${JAR_FILE} /opt/app.jar   # Copie un fichier de l’hôte dans le container

ENTRYPOINT ["java","-jar","/opt/app.jar"]

the docker-compose

version: '3.8'

services:
    db:
        #restart: always
        container_name: db
        image: mysql:5.7
        restart: always
        ports:
          - "3006:3306"
        environment:
          MYSQL_ROOT_PASSWORD: ****
          MYSQL_DATABASE: azuredatabase

    app:
      restart: on-failure
      depends_on:
        - db
      build: ./app
      ports:
        - "9090:8080"
      restart: always

Solution

  • Then now I don't know what is the next thing that I should do, should I use multistage build? or write my pipeline in azure and do the CI?

    If you want to build your application next, you need to create and write a pipeline.

    As for multi-stage builds, you can put that aside for a while. You can write the jobs and tasks you want on one stage first, and then break them down into multiple stages.