Refactoring install actions

This commit is contained in:
Anton Vakhrushev 2024-12-25 11:26:45 +03:00
parent e4b27c55bf
commit 786efb4503
Signed by: av
GPG Key ID: F5BF52FC352E255A
11 changed files with 7544 additions and 16766 deletions

4
.gitignore vendored
View File

@ -1,5 +1,9 @@
.idea/ .idea/
.vscode/ .vscode/
.cache/
.config/
.home/
output_* output_*
node_modules/ node_modules/
var/ var/

View File

@ -10,16 +10,6 @@ ifeq ($(TARGET), prod)
APP_NPM_BUILD_CMD := build-prod APP_NPM_BUILD_CMD := build-prod
endif endif
# Installation
install: build-docker install-php-deps install-js-deps
install-php-deps:
./tools/composer install --no-interaction
install-js-deps:
./tools/npm ci
# Building # Building
clean: clean:

View File

@ -3,9 +3,27 @@
version: '3' version: '3'
vars: vars:
USER_ID:
sh: id -u
GROUP_ID:
sh: id -g
PROJECT: "homepage" PROJECT: "homepage"
PHP_IMAGE: "{{.PROJECT}}-php" PHP_IMAGE: "{{.PROJECT}}-php"
NODE_IMAGE: "{{.PROJECT}}-node" NODE_IMAGE: "{{.PROJECT}}-node"
DOCKER_COMMON_OPTS: >-
--rm
--interactive
--tty
--user {{.USER_ID}}:{{.GROUP_ID}}
--volume /etc/passwd:/etc/passwd:ro
--volume /etc/group:/etc/group:ro
--volume "./:/srv/app"
--workdir "/srv/app"
-e XDG_CONFIG_HOME=/srv/app/.config
-e XDG_CACHE_HOME=/srv/app/.cache
-e HOME=/srv/app/.home
tasks: tasks:
@ -13,3 +31,22 @@ tasks:
cmds: cmds:
- docker build --file docker/php/Dockerfile --tag "{{.PHP_IMAGE}}" . - docker build --file docker/php/Dockerfile --tag "{{.PHP_IMAGE}}" .
- docker build --file docker/node/Dockerfile --tag "{{.NODE_IMAGE}}" . - docker build --file docker/node/Dockerfile --tag "{{.NODE_IMAGE}}" .
composer:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.PHP_IMAGE}}" composer {{.CLI_ARGS}}
shell-node:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" bash
npm:
cmds:
- docker run {{.DOCKER_COMMON_OPTS}} "{{.NODE_IMAGE}}" npm {{.CLI_ARGS}}
install-dependencies:
cmds:
- task: composer
vars: { CLI_ARGS: "install" }
- task: npm
vars: { CLI_ARGS: "install" }

View File

@ -9,7 +9,7 @@
} }
], ],
"require": { "require": {
"php": "~7.4", "php": "^8.0",
"ext-tidy": "*" "ext-tidy": "*"
}, },
"require-dev": { "require-dev": {

896
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,6 @@
FROM node:12.22.3-alpine FROM node:12
RUN npm install -g npm ENV npm_config_fund=false
ENV npm_config_update_notifier=false
WORKDIR /srv/app

View File

@ -1,5 +1,7 @@
FROM php:8.1-cli FROM php:8.1-cli
ENV COMPOSER_FUND=0
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
curl \ curl \
git \ git \

16095
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

7216
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
#!/bin/bash
source .env
mkdir -p var/docker-cache/.composer
docker run \
--rm \
--interactive \
--tty \
--user "$UID:$(id -g)" \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume "$PWD:/srv/app" \
--volume "$HOME:$HOME" \
--volume "$PWD/var/docker-cache/.composer:/tmp/.composer" \
--env COMPOSER_HOME=/tmp/.composer \
"${PHP_IMAGE}" \
composer "$@"

View File

@ -1,20 +0,0 @@
#!/bin/bash
source .env
mkdir -p var/docker-cache/.npm
docker run \
--rm \
--interactive \
--tty \
--user "$UID:$(id -g)" \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume "$PWD:/srv/app" \
--volume "$HOME:$HOME" \
--volume "$PWD/var/docker-cache/.npm:/tmp/.npm" \
--env npm_config_cache=/tmp/.npm \
--workdir /srv/app \
"${NODE_IMAGE}" \
npm "$@"