Seems like docker tries to bind all directories under docker in root:
/* SRC FILES */
docker/
deploy/
service.yml
volume/
redis/.gitkeep
logs/.gitkeep
I was unabled to find any information about automatic bind under such directory or find such setting in compose or gitlab ci
Unfortunally, I can’t show full configuration, but here config, ci and error message at least:
# .gitlab-ci.yml
# Already checked, include files just build and perform php related actions, no docker or env vars involved
include:
- project: project/repository
file: "deploy/php-ci.yml"
stages:
- build
- test
- release
variables:
IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
PROJECT_CODE: "service-2"
PROJECT_NAMESPACE: "service-2"
cache:
paths:
- vendor/
- node_modules/
branch-build:
rules:
- if: $CI_COMMIT_BRANCH == 'stage'
when: always
- if: $CI_COMMIT_BRANCH == 'main'
when: always
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
- if: $CI_COMMIT_BRANCH == 'devops'
when: always
unit-test:
stage: test
image: $IMAGE
allow_failure: false
needs:
- branch-build
variables:
ELASTIC_HOST: "elasticsearch.logs:9300"
ELASTIC_LOGS_INDEX: "test_service_api"
before_script:
- COMPOSER_ALLOW_SUPERUSER=1 composer install --dev --no-interaction
- cp .env.example .env
- php artisan key:generate
script:
- php artisan test
rules:
- if: $CI_COMMIT_BRANCH == 'main'
when: always
- if: $CI_COMMIT_BRANCH == 'stage'
when: always
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: always
- if: $CI_COMMIT_BRANCH == 'devops'
when: always
prod-deploy:
needs:
- branch-build
- unit-test
rules:
- if: $CI_COMMIT_BRANCH == 'main'
when: always
stage-deploy:
needs:
- branch-build
- unit-test
rules:
- if: $CI_COMMIT_BRANCH == 'stage'
when: always
# Mine written
devops-deploy:
stage: release
environment: staging
needs:
- branch-build
- unit-test
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- cp $ENV_STAGING ./docker/deploy/.env
- cat ./docker/deploy/.env
script:
- docker stack deploy -c ./docker/deploy/wizard.yml --with-registry-auth wizard
tags:
- swarm-stage
rules:
- if: $CI_COMMIT_BRANCH == 'devops'
when: always
# service.yml
version: "3.8"
services:
app:
image: ${IMAGE}
deploy:
replicas: 1
restart_policy:
condition: any
delay: 1s
update_config:
failure_action: rollback
parallelism: 1
delay: 10s
networks:
- proxy_main
- apiats-swarm-internal
ports:
- "8090:80"
working_dir: /var/www/html
env_file:
- .env
volumes:
# Explicit volume creation binding, no deploy directory here
- ./:/var/www/html
- ./docker/volumes/logs:/var/logs
labels:
- "traefik.enable=true"
- "traefik.http.routers.wizard-api-app.rule=Host(`service.local`)"
- "traefik.http.routers.wizard-api-app.entrypoints=web"
mailhog:
image: mailhog/mailhog:latest
deploy:
replicas: 1
restart_policy:
condition: any
delay: 1s
update_config:
failure_action: rollback
parallelism: 1
delay: 10s
ports:
- "8025"
networks:
- swarm-internal
networks:
proxy_main:
external: true
swarm-internal:
external: true
FROM php:8.2.15-apache
RUN apt-get update && apt-get install -y
curl
libpng-dev
libonig-dev
libxml2-dev
zip
unzip
supervisor
zlib1g-dev
ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN a2enmod rewrite headers
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd opcache iconv
RUN unlink /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
ENV LOG_CHANNEL=stderr
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
RUN pecl install redis && docker-php-ext-enable redis
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
WORKDIR /var/www/html
COPY *.json *.lock ./
COPY . .
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./.build/supervisor.conf /etc/supervisor/conf.d/ss.conf
RUN cp "/var/www/html/.build/php.ini" "$PHP_INI_DIR/php.ini"
RUN composer check-platform-reqs
&& COMPOSER_ALLOW_SUPERUSER=1 composer install
--no-dev
--prefer-dist
--no-scripts
--optimize-autoloader
--no-interaction
&& composer clear-cache
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["apache2-foreground"]
I tried to remove include, but seems like problem somewhere in another place
New contributor
ChannelDSR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1