67 lines
1.9 KiB
Docker
67 lines
1.9 KiB
Docker
# --- COMPOSER INSTALL
|
|
FROM composer:2.9.2 AS vendor
|
|
|
|
ARG GITLAB_USER
|
|
ARG GITLAB_PASSWORD
|
|
|
|
COPY database/ database/
|
|
|
|
COPY composer.json composer.json
|
|
COPY composer.lock composer.lock
|
|
|
|
RUN composer config gitlab-token.lab.s-web.fr ${GITLAB_USER} ${GITLAB_PASSWORD}
|
|
RUN composer install \
|
|
--ignore-platform-reqs \
|
|
--no-interaction \
|
|
--no-plugins \
|
|
--no-scripts \
|
|
--no-dev \
|
|
--prefer-dist
|
|
|
|
# --- BUILD MJML BINARY
|
|
FROM node:24-trixie AS mjml-builder
|
|
|
|
WORKDIR /build
|
|
|
|
RUN npm init -y && \
|
|
npm install mjml @yao-pkg/pkg
|
|
|
|
RUN npm pkg set pkg.scripts="node_modules/mjml*/**/*.js"
|
|
|
|
RUN npx @yao-pkg/pkg node_modules/mjml/bin/mjml \
|
|
--target linuxstatic-x64 \
|
|
--output /build/mjml-bin
|
|
|
|
# --- BUILD ASSETS
|
|
FROM node:24-alpine AS frontend
|
|
|
|
ARG GITLAB_PASSWORD
|
|
|
|
RUN mkdir -p /app/public/build
|
|
|
|
COPY package*.json tsconfig.json vite.config.ts eslint.config.js .stylelintrc.json /app/
|
|
COPY resources/ /app/resources/
|
|
WORKDIR /app
|
|
|
|
RUN npm config set @ldc-web:registry https://lab.s-web.fr/api/v4/packages/npm/
|
|
RUN npm config set -- '//lab.s-web.fr/api/v4/packages/npm/:_authToken' "${GITLAB_PASSWORD}"
|
|
RUN npm config set @uwil:registry https://lab.s-web.fr/api/v4/groups/ldc-web/-/packages/npm/
|
|
RUN npm config set -- '//lab.s-web.fr/api/v4/groups/ldc-web/-/packages/npm/:_authToken' "${GITLAB_PASSWORD}"
|
|
RUN npm ci --no-audit --no-fund --loglevel=error && npm run prod
|
|
|
|
# --- RUN
|
|
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/uwil-production-8.5:${PHP_8_5_TAG}
|
|
|
|
ARG USER=www-data
|
|
|
|
# MJML binary
|
|
COPY --chown=${USER}:${USER} --from=mjml-builder /build/mjml-bin /usr/local/bin/mjml
|
|
|
|
COPY --chown=${USER}:${USER} . /app/srcs
|
|
COPY --chown=${USER}:${USER} ./resources/favicon /app/srcs/public
|
|
COPY --from=vendor --chown=${USER}:${USER} /app/vendor/ /app/srcs/vendor/
|
|
COPY --from=frontend --chown=${USER}:${USER} /app/public/build/ /app/srcs/public/build/
|
|
|
|
USER root
|
|
RUN chmod -R 755 /app/srcs/storage
|
|
USER ${USER}
|