Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

Circle CI , laravel project docker error

Hello , I am studding a course of laravel with docker . of Andrew Schmelyun . well , at the end of the course we deploy with Circle CI , a Laravel Docker Project . It didnt work for me .

Errror -

#!/bin/bash -eo pipefail
sudo apt update
0% [Working]Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
0% [Waiting for headers] [1 InRelease 8004 B/48.4 kB 17%] [Connected to dl.googGet:2 http://deb.debian.org/debian bullseye InRelease [116 kB]                 
0% [2 InRelease 2266 B/116 kB 2%] [1 InRelease 8004 B/48.4 kB 17%] [Connected t0% [2 InRelease 116 kB/116 kB 100%] [Connected to dl.google.com (142.250.81.206Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]        
0% [Connected to dl.google.com (142.250.81.206)]                               Get:4 https://dl.google.com/linux/chrome/deb stable InRelease [1811 B]
0% [4 InRelease 1811 B/1811 B 100%]             0% [Working]                       0% [Working]Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [167 kB]
0% [5 Packages 15.8 kB/167 kB 9%]0% [Working]                     0% [5 Packages store 0 B]0% [Working]             0% [Working]Get:6 http://deb.debian.org/debian bullseye/main amd64 Packages [8182 kB]
0% [6 Packages 16.4 kB/8182 kB 0%]0% [Working]                      0% [6 Packages store 0 B]0% [6 Packages store 0 B]Get:7 http://deb.debian.org/debian bullseye-updates/main amd64 Packages.diff/Index [8361 B]
0% [6 Packages store 0 B] [7 Packages 8361 B/8361 B 100%]0% [6 Packages store 0 B]                                Get:8 http://deb.debian.org/debian bullseye-updates/main amd64 Packages T-2022-06-11-2007.01-F-2022-01-24-2024.03.pdiff [1188 B]
0% [6 Packages store 0 B] [8 Packages 1188 B/1188 B 100%]0% [6 Packages store 0 B]                                Get:8 http://deb.debian.org/debian bullseye-updates/main amd64 Packages T-2022-06-11-2007.01-F-2022-01-24-2024.03.pdiff [1188 B]
0% [8 Packages rred 0 B] [6 Packages store 0 B]0% [6 Packages store 0 B]                      Err:4 https://dl.google.com/linux/chrome/deb stable InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
97% [6 Packages store 0 B]97% [6 Packages store 0 B]98% [Working]             Reading package lists... Done
N: Repository 'http://deb.debian.org/debian bullseye InRelease' changed its 'Version' value from '11.1' to '11.4'
W: GPG error: https://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4EB27DB2A3B88B8B
E: The repository 'https://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Exited with code exit status 100
CircleCI received exit code 100

.cicleci.yml

version: 2
jobs:
  build:
    working_directory: ~/project/src
    docker:
      - image: circleci/php:7.4-node-browsers

      - image: circleci/mysql:5.7-ram
        command: mysqld --default-authentication-plugin=mysql_native_password
        environment:
          MYSQL_USER: laravel
          MYSQL_DATABASE: laraveldb
          MYSQL_ROOT_PASSWORD: secret
          MYSQL_PASSWORD: secret

    steps:
      - checkout:
          path: ~/project

      - add_ssh_keys:
          fingerprints:
            - "MY-FINGERPRINTS-GO-HERE"

      - run: sudo apt update
      - run: sudo docker-php-ext-install zip pdo pdo_mysql bcmath

      - run: mv .env.example .env

      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "composer.json" }}
            - v1-dependencies-

      - run: composer install -n --prefer-dist

      - save_cache:
          key: v1-dependencies-{{ checksum "composer.json" }}
          paths:
            - ./vendor

      - run: php artisan key:generate

      - run: touch storage/testing.sqlite
      - run: php artisan migrate --env=testing --database=mysql --force

      - run: ./vendor/bin/phpunit

  deploy:
    machine:
      enabled: true
    steps:
      - run:
          name: Deploy over SSH
          command: |
            ssh -o StrictHostKeyChecking=no [email protected] 'cd /home/docker/site && git fetch origin main && git reset --hard origin/main && git pull origin main && docker-compose -f docker-compose.prod.yml up -d --build nginx'

workflows:
  version: 2
  build-and-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: main

docker-compose.prod.yml -

version: '3.8'

networks:
  laravel:
    name: laravel

services:
  nginx:
    build:
      context: .
      dockerfile: nginx.prod.dockerfile
    container_name: nginx
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    depends_on:
      - php
      - mysql
      - redis
    ports:
      - 80:80
      - 443:443
    networks:
      - laravel

  php:
    build:
      context: .
      dockerfile: php.prod.dockerfile
    container_name: php
    networks:
      - laravel

  mysql:
    image: mysql:5.7.32
    container_name: mysql
    ports:
      - 4306:3306
    environment:
      MYSQL_DATABASE: laraveldb
      MYSQL_USER: laravel
      MYSQL_PASSWORD: secret
      MYSQL_ROOT_PASSWORD: secret
    networks:
      - laravel

  composer:
    image: composer:latest
    container_name: composer
    volumes:
      - ./src:/var/www/html
    working_dir: /var/www/html
    depends_on:
      - php
    networks:
      - laravel

  artisan:
    build:
      context: .
      dockerfile: php.prod.dockerfile
    container_name: artisan
    working_dir: /var/www/html
    entrypoint: ["php", "artisan"]
    networks:
      - laravel

  npm:
    image: node:13.7
    container_name: npm
    volumes: 
      - ./src:/var/www/html
    working_dir: /var/www/html
    entrypoint: ["npm"]
    networks:
      - laravel

  phpunit:
   build:
     context: .
     dockerfile: php.prod.dockerfile
   container_name: phpunit
   working_dir: /var/www/html
   entrypoint: ["/var/www/html/vendor/bin/phpunit"]
   depends_on:
     - php
   networks:
     - laravel

  redis:
    image: redis:alpine
    restart: unless-stopped
    container_name: redis
    ports:
      - 6379:6379
    networks:
      - laravel

  scheduler:
    build:
      context: .
      dockerfile: php.prod.dockerfile
    container_name: scheduler
    working_dir: /var/www/html
    entrypoint: ["php", "artisan", "schedule:work"]
    networks:
      - laravel

  certbot:
    image: certbot/certbot
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
      

php.dockerfile -

FROM php:8.1-fpm-alpine

ADD ./php/www.conf /usr/local/etc/php-fpm.d/www.conf

RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel

RUN mkdir -p /var/www/html

RUN docker-php-ext-install pdo pdo_mysql

RUN apk --no-cache add pcre-dev ${PHPIZE_DEPS} \
    && pecl install redis \
    && docker-php-ext-enable redis \
    && apk del pcre-dev ${PHPIZE_DEPS}

RUN chown laravel:laravel /var/www/html


0 likes
0 replies

Please or to participate in this conversation.