Téléverser les fichiers vers "/"

This commit is contained in:
LiittleCookie 2025-09-02 19:09:45 +00:00
commit ea1e796347
2 changed files with 84 additions and 0 deletions

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
FROM composer:2 AS vendor
WORKDIR /app
ARG REPO_URL
ARG DEPLOY_KEY_B64
RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh
RUN echo "$DEPLOY_KEY_B64" | base64 -d > /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa
RUN ssh-keyscan git.ewelit.fr >> /root/.ssh/known_hosts
RUN git clone --depth=1 $REPO_URL .
RUN composer install --no-interaction --prefer-dist --no-progress
FROM php:8.4-fpm-alpine
RUN apk add --no-cache icu-libs libzip git bash \
&& apk add --no-cache --virtual .build-deps $PHPIZE_DEPS icu-dev libzip-dev oniguruma-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) pdo_mysql intl opcache \
&& apk del .build-deps
COPY ./php/conf.d/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
WORKDIR /var/www/html
COPY --from=vendor /app /var/www/html
RUN chown -R www-data:www-data /var/www/html
COPY ./php/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 9000
ENTRYPOINT ["entrypoint.sh"]

52
docker-compose.yml Normal file
View File

@ -0,0 +1,52 @@
version: "3.9"
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
REPO_URL: "${REPO_URL}"
DEPLOY_KEY_B64: "${DEPLOY_KEY}"
container_name: slim-app
environment:
APP_ENV: ${APP_ENV}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_DATABASE: ${DB_DATABASE}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
depends_on:
db:
condition: service_healthy
web:
image: nginx:1.27-alpine
container_name: slim-web
ports:
- "8080:80"
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- app
db:
image: mariadb:11.4
container_name: slim-db
environment:
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MARIADB_DATABASE: ${DB_DATABASE}
MARIADB_USER: ${DB_USERNAME}
MARIADB_PASSWORD: ${DB_PASSWORD}
ports:
- "${DB_EXPOSE_PORT}:3306"
volumes:
- dbdata:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
volumes:
dbdata: