Skip to content

Commit

Permalink
Test.
Browse files Browse the repository at this point in the history
  • Loading branch information
sherifabdlnaby committed Nov 21, 2024
1 parent bccc17f commit 196dcad
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
with:
dev: no
command: create-project
args: --no-install --no-scripts symfony/symfony-demo:v2.1.0 app
php_version: 8.1
args: --no-install --no-scripts symfony/symfony-demo:v2.4 app
php_version: 8.3
- name: Build & Deploy
run: make deploy
- name: Test the App Startup
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# ---------------------------------------------- Build Time Arguments --------------------------------------------------
ARG PHP_VERSION="8.1"
ARG PHP_ALPINE_VERSION="3.16"
ARG PHP_VERSION="8.3"
ARG PHP_ALPINE_VERSION="3.20"
ARG NGINX_VERSION="1.21"
ARG COMPOSER_VERSION="2"
ARG XDEBUG_VERSION="3.1.3"
ARG COMPOSER_VERSION="2.2"
ARG XDEBUG_VERSION="3.3.1"
ARG COMPOSER_AUTH
ARG APP_BASE_DIR="."

# -------------------------------------------------- Composer Image ----------------------------------------------------

FROM composer:${COMPOSER_VERSION} as composer
FROM composer:${COMPOSER_VERSION} AS composer

# ======================================================================================================================
# --- Base ---
Expand All @@ -30,7 +30,7 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

# ------------------------------------- Install Packages Needed Inside Base Image --------------------------------------

RUN RUNTIME_DEPS="tini fcgi"; \
RUN RUNTIME_DEPS="tini fcgi linux-headers"; \
SECURITY_UPGRADES="curl"; \
apk add --no-cache --upgrade ${RUNTIME_DEPS} ${SECURITY_UPGRADES}

Expand Down Expand Up @@ -131,7 +131,7 @@ CMD ["php-fpm"]
# --------------- This stage will install composer runtime dependinces and install app dependinces. ------------------
# ======================================================================================================================

FROM composer as vendor
FROM composer AS vendor

ARG PHP_VERSION
ARG COMPOSER_AUTH
Expand Down Expand Up @@ -196,7 +196,7 @@ CMD ["php-fpm"]
# --- DEV ---
# ======================================================================================================================

FROM base as app-dev
FROM base AS app-dev


ENV APP_ENV dev
Expand Down
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,55 @@ COMMAND ?= /bin/sh
command-root shell-root shell restart rm help

deploy: ## Start using Prod Image in Prod Mode
${COMPOSE_PREFIX_CMD} docker-compose -f docker-compose.prod.yml up --build -d
${COMPOSE_PREFIX_CMD} docker compose -f docker-compose.prod.yml up --build -d

up: ## Start service
@echo "Starting Application \n (note: Web container will wait App container to start before starting)"
${COMPOSE_PREFIX_CMD} docker-compose up -d
${COMPOSE_PREFIX_CMD} docker compose up -d

build-up: ## Start service, rebuild if necessary
${COMPOSE_PREFIX_CMD} docker-compose up --build -d
${COMPOSE_PREFIX_CMD} docker compose up --build -d

build: ## Build The Image
${COMPOSE_PREFIX_CMD} docker-compose build
${COMPOSE_PREFIX_CMD} docker compose build

down: ## Down service and do clean up
${COMPOSE_PREFIX_CMD} docker-compose down
${COMPOSE_PREFIX_CMD} docker compose down

start: ## Start Container
${COMPOSE_PREFIX_CMD} docker-compose start
${COMPOSE_PREFIX_CMD} docker compose start

stop: ## Stop Container
${COMPOSE_PREFIX_CMD} docker-compose stop
${COMPOSE_PREFIX_CMD} docker compose stop

logs: ## Tail container logs with -n 1000
@${COMPOSE_PREFIX_CMD} docker-compose logs --follow --tail=100
@${COMPOSE_PREFIX_CMD} docker compose logs --follow --tail=100

images: ## Show Image created by this Makefile (or Docker-compose in docker)
@${COMPOSE_PREFIX_CMD} docker-compose images
images: ## Show Image created by this Makefile (or docker compose in docker)
@${COMPOSE_PREFIX_CMD} docker compose images

ps: ## Show Containers Running
@${COMPOSE_PREFIX_CMD} docker-compose ps
@${COMPOSE_PREFIX_CMD} docker compose ps

command: ## Execute command ( make command COMMAND=<command> )
@${COMPOSE_PREFIX_CMD} docker-compose run --rm app ${COMMAND}
@${COMPOSE_PREFIX_CMD} docker compose run --rm app ${COMMAND}

command-root: ## Execute command as root ( make command-root COMMAND=<command> )
@${COMPOSE_PREFIX_CMD} docker-compose run --rm -u root app ${COMMAND}
@${COMPOSE_PREFIX_CMD} docker compose run --rm -u root app ${COMMAND}

shell-root: ## Enter container shell as root
@${COMPOSE_PREFIX_CMD} docker-compose exec -u root app /bin/sh
@${COMPOSE_PREFIX_CMD} docker compose exec -u root app /bin/sh

shell: ## Enter container shell
@${COMPOSE_PREFIX_CMD} docker-compose exec app /bin/sh
@${COMPOSE_PREFIX_CMD} docker compose exec app /bin/sh

restart: ## Restart container
@${COMPOSE_PREFIX_CMD} docker-compose restart
@${COMPOSE_PREFIX_CMD} docker compose restart

rm: ## Remove current container
@${COMPOSE_PREFIX_CMD} docker-compose rm -f
@${COMPOSE_PREFIX_CMD} docker compose rm -f

help: ## Show this help.
@echo "\n\nMake Application Docker Images and Containers using Docker-Compose files"
@echo "Make sure you are using \033[0;32mDocker Version >= 20.1\033[0m & \033[0;32mDocker-Compose >= 1.27\033[0m "
@echo "\n\nMake Application Docker Images and Containers using Docker Compose files"
@echo "Make sure you are using \033[0;32mDocker Version >= 20.1\033[0m & \033[0;32mDocker Compose >= 1.27\033[0m "
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m ENV=<prod|dev> (default: dev)\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-12s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

0 comments on commit 196dcad

Please sign in to comment.