Continuous Integration - Test and PRD on the same server with Docker-Compose and Travis-CI

Asked

Viewed 25 times

0

I have a Java system with Spring running in a Docker container with Docker-Compose. Integration works with Github >> Travis-CI >> Docker (on the server).

I’m trying to assemble two applications from the same repository (one test and one production) on the same server (each responding on its port). But every time I make one docker-compose pull in the test container it updates the image, and consequently updates the two containers (test and production).

I don’t have as much experience with Docker, but I believe that this must be happening because of the image that is unique.

What would be the best format to be able to individualize the pull of each container? Maybe put together two images? If that’s the way, would someone tell me how I can set up Docker-Compose.yml to mount two images from the same repository?

My Docker-Compose.yml is like this

version: '3.4'
services:
  db-easy:
    image: mysql:5.7.22
    command: mysqld --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
      TZ: America/Sao_Paulo
      MYSQL_ROOT_PASSWORD: *************
      MYSQL_USER: easy
      MYSQL_PASSWORD: *********
      MYSQL_DATABASE: easy
    ports:
      - "3308:3306"
    networks:
      - easy-network
  easy-call:
    image: agcaldeira/easy-call
    restart: always
    working_dir: /EasyCall
    environment:
      TZ: America/Sao_Paulo
    ports:
      - "80:8080" 
    command: mvn spring-boot:run
    depends_on:
      - db-easy
    networks:
      - easy-network
networks:
    easy-network:
        driver: bridge

On the server I have two very similar Docker-Compose.yml. The only differences are the external ports. If anyone knows how to fix it give me a help please.

Thank you.

  • use different service names, for example easy-call and easy-call-tests

  • Hi @Ricardo, thanks for replying. pull, He updated the image (single) and marked it as Latest. When restarting the containers the two were updated (even pulling only in test). Below is a snippet of the Docker-Compose.yml test: easy-call-test: image: agcaldeira/easy-call Restart: Always working_dir: /Easycall Environment: TZ: America/Sao_paulo Do you have any suggestions? Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.