On this page
article
Docker
Logging to stdout:
> /dev/stdout
Increase php cli memory size for one command
php -d
Dockerfile
Create non-root user. In this case we remove the node user and create a new one called application
RUN userdel -r node \
&& useradd application --home-dir /home/application --uid 1000 \
&& mkdir -p /home/application /app \
&& chown application:application /home/application /app
COPY --from build_stage --chown=application:application /build/out/ /app/
Install Packages and Remove Cache
apt-get update \
&& apt-get install -y \
abc \
def \
&& rm -rf /var/lib/apt/lists/*
Limit a services memory / cpu usage
services:
stress:
image: image
deploy:
replicas: 1
resources:
limits:
cpus: '0.50'
memory: 750M
Using webdevops
cronjob
RUN docker-cronjob '* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1'
supervisor apps
Copy to /opt/docker/etc/supervisor.d/
Example:
[group:hhvm]
programs=hhvmd
priority=20
[program:hhvmd]
command = /opt/docker/bin/service.d/hhvm.sh
process_name=%(program_name)s
directory = /var/run/hhvm/
startsecs = 0
autostart = true
autorestart = true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
Env file
If you need to do spaces, you must escape them
APP_NAME=my\ app\ name
Tricks
Copy from docker image -> file: source
docker run --rm --entrypoint cat yourimage /path/to/file > path/to/destination