lundi 1 juin 2020

Proper way to configure a dockerized Laravel project with queue worker and tag with docker-compose

I am struggling a bit on how to configure a Laravel project I have configured with Gitlab pipelines for production. My project is running on Azure and I am struggling with two things.

1.- Check if queue worker is running
2.- How to push docker-compose image to container registry with tag. docker build -t tag can do it, however, it won't tag me the service that runs the queue worker.

My pipeline is

build azure:
  stage: build
  allow_failure: false
  image: docker/compose:latest
  services:
    - docker:stable-dind
  script:
    - docker login $REPO.azurecr.io -u $AZURE_USER -p $AZURE_PASSWORD
    - docker-compose -f docker-compose.build.yml down
    - docker-compose -f docker-compose.build.yml build
    - docker-compose -f docker-compose.build.yml push 

And my docker-compose

version: "3.6"
services:
  app:
    image: ${REPO}.azurecr.io/${REPO_NAME}:latest
    build:
      context: .
      dockerfile: ./setup/Dockerfile
    container_name: simple2_web
    restart: unless-stopped
    tty: true
    volumes: 
      - uploads:/var/www/simple/public/uploads
      - logos:/var/www/simple/public/logos
    networks:
      - mynet

  worker:
    image: ${REPO}.azurecr.io/${REPO_NAME}:latest
    command: ["php artisan queue:work --timeout=0"]
    depends_on: 
      - app
    networks:
      - mynet

volumes: 
  uploads:
  logos:

networks: 
  mynet:


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire