Skip to content

Commit

Permalink
Use run for various commands
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Oct 25, 2024
1 parent d46be94 commit 28eea78
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This ignore file is used for COPY statement within Dockerfile when building production image.

# Ignore everything
*

Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ up-build: ## Up the dev environment rebuilding images.
down: ## Down the dev environment.
docker compose -f docker/compose.yml -f docker/compose.dev.yml down --remove-orphans

run: ## Run a command within the container.
exec: ## Run a command within the existing container.
docker compose -f docker/compose.yml -f docker/compose.dev.yml exec app $(CMD) $(RUN_ARGS)

run: ## Run a command within a temporary container.
docker compose -f docker/compose.yml -f docker/compose.dev.yml run --rm --entrypoint $(CMD) app $(RUN_ARGS)

shell: CMD="/bin/sh" ## Get into container shell.
shell: run
shell: exec

yii: CMD="./yii" ## Execute Yii command.
yii: run
Expand Down
1 change: 0 additions & 1 deletion basename

This file was deleted.

4 changes: 2 additions & 2 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ PROD_SSH="ssh://docker-web"
IMAGE=app-api
IMAGE_TAG=latest

XDEBUG_MODE:off

DEV_PORT=80

# XDEBUG_MODE=develop,debug
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ ARG GID=10001
RUN <<SH
set -eo pipefail
set -x

# Add www-data group and user.
addgroup -g ${GID} -S www-data
adduser -u ${UID} -D -S -G www-data www-data

# Set volume permissions
# Set volume permissions.
mkdir -p /data /config /app/runtime && \
chown -R www-data:www-data /data /config /app/runtime

# Install extra packages.
apk add --no-cache \
php-frankenphp-8.3-opcache \
php-frankenphp-8.3-mbstring \
Expand Down
6 changes: 3 additions & 3 deletions docker/compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ services:
UID: ${UID}
GID: ${GID}
environment:
XDEBUG_MODE: "${XDEBUG_MODE:-off}"
YII_ENV: "dev"
YII_DEBUG: true
XDEBUG_MODE: "${XDEBUG_MODE:-develop}"
YII_ENV: "${YII_ENV:-dev}"
YII_DEBUG: ${YII_DEBUG:-true}
SERVER_NAME: ":80"
restart: unless-stopped
ports:
Expand Down
2 changes: 2 additions & 0 deletions docker/compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ services:
- caddy_config:/config
environment:
SERVER_NAME: ":80"
YII_ENV: "${YII_ENV:-prod}"
YII_DEBUG: ${YII_DEBUG:-false}
deploy:
replicas: 2
update_config:
Expand Down

0 comments on commit 28eea78

Please sign in to comment.