Skip to content

Commit 987db91

Browse files
committed
added docker for local development
1 parent caebb00 commit 987db91

File tree

13 files changed

+756
-0
lines changed

13 files changed

+756
-0
lines changed

docker-compose.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
version: '3'
2+
services:
3+
4+
# Application - Vökuró
5+
tutorial-8.0:
6+
build: resources/docker/8.0
7+
container_name: tutorial-8.0
8+
tty: true
9+
working_dir: /code
10+
depends_on:
11+
- tutorial-mysql
12+
volumes:
13+
- ./:/code
14+
networks:
15+
- tutorial-network
16+
17+
tutorial-8.1:
18+
build: resources/docker/8.1
19+
container_name: tutorial-8.1
20+
tty: true
21+
working_dir: /code
22+
depends_on:
23+
- tutorial-mysql
24+
volumes:
25+
- ./:/code
26+
networks:
27+
- tutorial-network
28+
29+
tutorial-8.2:
30+
build: resources/docker/8.2
31+
container_name: tutorial-8.2
32+
tty: true
33+
working_dir: /code
34+
depends_on:
35+
- tutorial-mysql
36+
volumes:
37+
- ./:/code
38+
networks:
39+
- tutorial-network
40+
41+
tutorial-8.3:
42+
build: resources/docker/8.3
43+
container_name: tutorial-8.3
44+
tty: true
45+
working_dir: /code
46+
depends_on:
47+
- tutorial-mysql
48+
volumes:
49+
- ./:/code
50+
networks:
51+
- tutorial-network
52+
53+
# Database - Mysql
54+
tutorial-mysql:
55+
image: mysql:5.7
56+
container_name: tutorial-mysql
57+
tty: true
58+
environment:
59+
- MYSQL_ROOT_PASSWORD=secret
60+
- MYSQL_USER=phalcon
61+
- MYSQL_DATABASE=phalcon_tutorial
62+
- MYSQL_PASSWORD=secret
63+
volumes:
64+
- tutorial-volume:/var/lib/mysql/
65+
networks:
66+
- tutorial-network
67+
68+
# Network
69+
networks:
70+
tutorial-network:
71+
driver: bridge
72+
73+
# Volumes
74+
volumes:
75+
tutorial-volume:
76+
driver: local

resources/docker/8.0/Dockerfile

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM composer:latest as composer
2+
FROM php:8.0-fpm
3+
4+
COPY ./config/extra.ini /usr/local/etc/php/conf.d/
5+
6+
# Set working directory
7+
WORKDIR /code
8+
9+
LABEL vendor="Phalcon" \
10+
maintainer="Phalcon Team <[email protected]>" \
11+
description="The PHP image to test the tutorial application"
12+
13+
ENV PHALCON_VERSION="5.6.0"
14+
15+
# Update
16+
RUN apt update -y && \
17+
apt install -y \
18+
apt-utils \
19+
gettext \
20+
git \
21+
libzip-dev \
22+
nano \
23+
sudo \
24+
wget \
25+
zip
26+
27+
# PECL Packages
28+
RUN pecl install phalcon-${PHALCON_VERSION} \
29+
xdebug
30+
31+
# Install PHP extensions
32+
RUN docker-php-ext-install \
33+
gettext \
34+
pdo_mysql \
35+
zip
36+
37+
# Install PHP extensions
38+
RUN docker-php-ext-enable \
39+
opcache \
40+
phalcon \
41+
xdebug
42+
43+
# Clear cache
44+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
45+
46+
# Add user
47+
RUN groupadd -g 1000 phalcon
48+
RUN useradd -u 1000 -ms /bin/bash -g phalcon phalcon
49+
50+
# Composer
51+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
52+
53+
# Copy existing application directory contents
54+
COPY . /code
55+
56+
# Bash script with helper aliases
57+
COPY ./config/.bashrc /root/.bashrc
58+
COPY ./config/.bashrc /home/phalcon/.bashrc
59+
60+
# Copy existing application directory permissions
61+
COPY --chown=phalcon:phalcon . /code
62+
63+
# Change current user to phalcon
64+
USER phalcon
65+
66+
EXPOSE 80
67+
68+
CMD ["php", "-S", "0.0.0.0:80", "-t", "public/", ".htrouter.php"]

resources/docker/8.0/config/.bashrc

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
# Easier navigation: .., ..., ...., ....., ~ and -
4+
alias ..="cd .."
5+
alias ...="cd ../.."
6+
alias ....="cd ../../.."
7+
alias .....="cd ../../../.."
8+
alias ~="cd ~" # `cd` is probably faster to type though
9+
alias -- -="cd -"
10+
11+
# Shortcuts
12+
alias g="git"
13+
alias h="history"
14+
15+
# Detect which `ls` flavor is in use
16+
if ls --color > /dev/null 2>&1; then # GNU `ls`
17+
colorflag="--color"
18+
else # OS X `ls`
19+
colorflag="-G"
20+
fi
21+
22+
# List all files colorized in long format
23+
# shellcheck disable=SC2139
24+
alias l="ls -lF ${colorflag}"
25+
26+
# List all files colorized in long format, including dot files
27+
# shellcheck disable=SC2139
28+
alias la="ls -laF ${colorflag}"
29+
30+
# List only directories
31+
# shellcheck disable=SC2139
32+
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
33+
34+
# See: https://superuser.com/a/656746/280737
35+
alias ll='LC_ALL="C.UTF-8" ls -alF'
36+
37+
# Always use color output for `ls`
38+
# shellcheck disable=SC2139
39+
alias ls="command ls ${colorflag}"
40+
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
41+
42+
# Always enable colored `grep` output
43+
alias grep='grep --color=auto '
44+
45+
# Enable aliases to be sudo’ed
46+
alias sudo='sudo '
47+
48+
# Get week number
49+
alias week='date +%V'
50+
51+
# Stopwatch
52+
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
53+
54+
# Canonical hex dump; some systems have this symlinked
55+
command -v hd > /dev/null || alias hd="hexdump -C"
56+
57+
# vhosts
58+
alias hosts='sudo nano /etc/hosts'
59+
60+
# copy working directory
61+
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'
62+
63+
# copy file interactive
64+
alias cp='cp -i'
65+
66+
# move file interactive
67+
alias mv='mv -i'
68+
69+
# untar
70+
alias untar='tar xvf'
71+
72+
# Zephir related
73+
alias untar='tar xvf'
74+
75+
PATH=$PATH:./vendor/bin

resources/docker/8.0/config/extra.ini

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error_reporting = E_ALL
2+
display_errors = "On"
3+
display_startup_errors = "On"
4+
log_errors = "On"
5+
error_log = /code/php_errors.log
6+
memory_limit = 512M
7+
apc.enable_cli = "On"
8+
session.save_path = "/tmp"
9+
10+
;xdebug
11+
xdebug.client_host = "localhost"
12+
xdebug.client_port = 9090
13+
xdebug.discover_client_host = 1
14+
xdebug.force_display_errors = 0
15+
xdebug.force_error_reporting = 0
16+
xdebug.max_nesting_level = 256
17+
xdebug.mode = coverage, debug, develop
18+
xdebug.output_dir = "/tmp"
19+
xdebug.remote_cookie_expire_time = 3600
20+
xdebug.remote_mode = "req"
21+
xdebug.show_error_trace = 1
22+
xdebug.show_exception_trace = 1
23+
xdebug.show_local_vars = 1
24+
xdebug.start_with_request = yes
25+
xdebug.var_display_max_children = 128
26+
xdebug.var_display_max_data = 512
27+
xdebug.var_display_max_depth = 3

resources/docker/8.1/Dockerfile

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM composer:latest as composer
2+
FROM php:8.1-fpm
3+
4+
COPY ./config/extra.ini /usr/local/etc/php/conf.d/
5+
6+
# Set working directory
7+
WORKDIR /code
8+
9+
LABEL vendor="Phalcon" \
10+
maintainer="Phalcon Team <[email protected]>" \
11+
description="The PHP image to test the tutorial application"
12+
13+
ENV PHALCON_VERSION="5.6.0"
14+
15+
# Update
16+
RUN apt update -y && \
17+
apt install -y \
18+
apt-utils \
19+
gettext \
20+
git \
21+
libzip-dev \
22+
nano \
23+
sudo \
24+
wget \
25+
zip
26+
27+
# PECL Packages
28+
RUN pecl install phalcon-${PHALCON_VERSION} \
29+
xdebug
30+
31+
# Install PHP extensions
32+
RUN docker-php-ext-install \
33+
gettext \
34+
pdo_mysql \
35+
zip
36+
37+
# Install PHP extensions
38+
RUN docker-php-ext-enable \
39+
opcache \
40+
phalcon \
41+
xdebug
42+
43+
# Clear cache
44+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
45+
46+
# Add user
47+
RUN groupadd -g 1000 phalcon
48+
RUN useradd -u 1000 -ms /bin/bash -g phalcon phalcon
49+
50+
# Composer
51+
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
52+
53+
# Copy existing application directory contents
54+
COPY . /code
55+
56+
# Bash script with helper aliases
57+
COPY config/.bashrc /root/.bashrc
58+
COPY config/.bashrc /home/phalcon/.bashrc
59+
60+
# Copy existing application directory permissions
61+
COPY --chown=phalcon:phalcon . /code
62+
63+
# Change current user to phalcon
64+
USER phalcon
65+
66+
EXPOSE 80
67+
68+
CMD ["php", "-S", "0.0.0.0:80", "-t", "public/", ".htrouter.php"]

resources/docker/8.1/config/.bashrc

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
# Easier navigation: .., ..., ...., ....., ~ and -
4+
alias ..="cd .."
5+
alias ...="cd ../.."
6+
alias ....="cd ../../.."
7+
alias .....="cd ../../../.."
8+
alias ~="cd ~" # `cd` is probably faster to type though
9+
alias -- -="cd -"
10+
11+
# Shortcuts
12+
alias g="git"
13+
alias h="history"
14+
15+
# Detect which `ls` flavor is in use
16+
if ls --color > /dev/null 2>&1; then # GNU `ls`
17+
colorflag="--color"
18+
else # OS X `ls`
19+
colorflag="-G"
20+
fi
21+
22+
# List all files colorized in long format
23+
# shellcheck disable=SC2139
24+
alias l="ls -lF ${colorflag}"
25+
26+
# List all files colorized in long format, including dot files
27+
# shellcheck disable=SC2139
28+
alias la="ls -laF ${colorflag}"
29+
30+
# List only directories
31+
# shellcheck disable=SC2139
32+
alias lsd="ls -lF ${colorflag} | grep --color=never '^d'"
33+
34+
# See: https://superuser.com/a/656746/280737
35+
alias ll='LC_ALL="C.UTF-8" ls -alF'
36+
37+
# Always use color output for `ls`
38+
# shellcheck disable=SC2139
39+
alias ls="command ls ${colorflag}"
40+
export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
41+
42+
# Always enable colored `grep` output
43+
alias grep='grep --color=auto '
44+
45+
# Enable aliases to be sudo’ed
46+
alias sudo='sudo '
47+
48+
# Get week number
49+
alias week='date +%V'
50+
51+
# Stopwatch
52+
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
53+
54+
# Canonical hex dump; some systems have this symlinked
55+
command -v hd > /dev/null || alias hd="hexdump -C"
56+
57+
# vhosts
58+
alias hosts='sudo nano /etc/hosts'
59+
60+
# copy working directory
61+
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'
62+
63+
# copy file interactive
64+
alias cp='cp -i'
65+
66+
# move file interactive
67+
alias mv='mv -i'
68+
69+
# untar
70+
alias untar='tar xvf'
71+
72+
# Zephir related
73+
alias untar='tar xvf'
74+
75+
PATH=$PATH:./vendor/bin

0 commit comments

Comments
 (0)