mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 01:43:13 +00:00
add dev utils to builder image
This commit is contained in:
18
Dockerfile
18
Dockerfile
@@ -82,8 +82,17 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
nodejs \
|
||||
yarn \
|
||||
nano \
|
||||
vim \
|
||||
iputils-ping \
|
||||
zsh \
|
||||
telnet \
|
||||
autoconf \
|
||||
libtool \
|
||||
pkg-config \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists \
|
||||
&& git clone https://github.com/robbyrussell/oh-my-zsh.git /bootstrap/.oh-my-zsh \
|
||||
&& mkdir -p /var/alchemy/Phraseanet \
|
||||
&& chown -R app:app /var/alchemy
|
||||
|
||||
@@ -99,10 +108,13 @@ RUN composer install --prefer-dist --no-dev --no-progress --no-suggest --classma
|
||||
|
||||
COPY --chown=app . .
|
||||
|
||||
RUN rm -rf docker/phraseanet/root \
|
||||
&& make install
|
||||
RUN make install
|
||||
|
||||
ADD docker/phraseanet/ /
|
||||
ADD ./docker/builder/root /
|
||||
|
||||
ENTRYPOINT ["/bootstrap/entrypoint.sh"]
|
||||
|
||||
CMD []
|
||||
|
||||
#########################################################################
|
||||
# Phraseanet web application image
|
||||
|
14
README.md
14
README.md
@@ -105,6 +105,20 @@ This can be made easily from the builder container:
|
||||
> Please note that the phraseanet image does not contain nor `composer` neither `node` tools. This allow the final image to be slim.
|
||||
> If you need to use dev tools, ensure you are running the `builder` image!
|
||||
|
||||
### Developer shell
|
||||
|
||||
You can also obtain a shell access in builder container:
|
||||
|
||||
```bash
|
||||
docker-compose run --rm builder /bin/bash
|
||||
# or
|
||||
docker-compose run --rm builder /bin/zsh
|
||||
```
|
||||
|
||||
In this container you will have the same libraries (PHP, Node, composer, ...) that are used to build images.
|
||||
Also you have utils for development like telnet, ping, ssh, git, ...
|
||||
Your $HOME/.ssh directory is also mounted to builder's home with your ssh agent.
|
||||
|
||||
### Using Xdebug
|
||||
|
||||
Xdebug is enabled by default with the `docker-compose.override.yml`
|
||||
|
@@ -10,25 +10,29 @@ services:
|
||||
|
||||
gateway:
|
||||
volumes:
|
||||
- ../:/var/alchemy
|
||||
- .:/var/alchemy/Phraseanet
|
||||
- ./docker/nginx/root/entrypoint.sh:/entrypoint.sh
|
||||
- ${PHRASEANET_DATA_DIR}:/var/alchemy/Phraseanet/datas:rw
|
||||
- ${PHRASEANET_THUMBNAILS_DIR}:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||
- ${PHRASEANET_TMP_DIR}:/var/alchemy/Phraseanet/tmp:rw
|
||||
|
||||
|
||||
|
||||
builder:
|
||||
build:
|
||||
context: .
|
||||
target: builder
|
||||
command: exit 0
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ../:/var/alchemy
|
||||
- .:/var/alchemy/Phraseanet
|
||||
- ${PHRASEANET_CONFIG_DIR}:/var/alchemy/Phraseanet/config:rw
|
||||
- ${PHRASEANET_LOGS_DIR}:/var/alchemy/Phraseanet/logs:rw
|
||||
- ${PHRASEANET_DATA_DIR}:/var/alchemy/Phraseanet/datas:rw
|
||||
- ${PHRASEANET_THUMBNAILS_DIR}:/var/alchemy/Phraseanet/www/thumbnails:rw
|
||||
- ${SSH_AUTH_SOCK}:/ssh-auth-sock
|
||||
- ${HOME}/.ssh:/home/app/.ssh
|
||||
- dev_vol:/home/app
|
||||
|
||||
phraseanet:
|
||||
environment:
|
||||
@@ -36,6 +40,7 @@ services:
|
||||
- XDEBUG_CONFIG=remote_host=${XDEBUG_REMOTE_HOST} idekey=${IDE_KEY} remote_enable=1 profiler_enable=${XDEBUG_PROFILER_ENABLED} profiler_output_dir=/var/alchemy/Phraseanet/cache/profiler
|
||||
- PHP_IDE_CONFIG
|
||||
volumes:
|
||||
- ../:/var/alchemy
|
||||
- .:/var/alchemy/Phraseanet
|
||||
- ${PHRASEANET_CONFIG_DIR}:/var/alchemy/Phraseanet/config:rw
|
||||
- ${PHRASEANET_LOGS_DIR}:/var/alchemy/Phraseanet/logs:rw
|
||||
@@ -45,6 +50,7 @@ services:
|
||||
|
||||
worker:
|
||||
volumes:
|
||||
- ../:/var/alchemy
|
||||
- .:/var/alchemy/Phraseanet
|
||||
- ${PHRASEANET_CONFIG_DIR}:/var/alchemy/Phraseanet/config:rw
|
||||
- ${PHRASEANET_LOGS_DIR}:/var/alchemy/Phraseanet/logs:rw
|
||||
@@ -77,3 +83,7 @@ networks:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: $PHRASEANET_SUBNET_IPS
|
||||
|
||||
volumes:
|
||||
dev_vol:
|
||||
driver: local
|
||||
|
@@ -0,0 +1,7 @@
|
||||
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
|
||||
PROMPT='%* %{$fg_bold[green]%}%n%{$fg[grey]%}@%m%{$fg_bold[green]%}%u ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="[%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}] %{$fg[yellow]%}✗%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}]"
|
56
docker/builder/root/bootstrap/.zshrc
Normal file
56
docker/builder/root/bootstrap/.zshrc
Normal file
@@ -0,0 +1,56 @@
|
||||
export LC_ALL=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
ZSH_THEME="alchemy"
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion. Case
|
||||
# sensitive completion must be off. _ and - will be interchangeable.
|
||||
# HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git symfony2)
|
||||
|
||||
# User configuration
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
alias ll='ls -alFh'
|
5
docker/builder/root/bootstrap/entrypoint.d/ohmyzsh.sh
Normal file
5
docker/builder/root/bootstrap/entrypoint.d/ohmyzsh.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||
cp -r "/bootstrap/.oh-my-zsh" "$HOME/.oh-my-zsh"
|
||||
fi
|
7
docker/builder/root/bootstrap/entrypoint.d/zshrc.sh
Normal file
7
docker/builder/root/bootstrap/entrypoint.d/zshrc.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
ZSH_FILE="$HOME/.zshrc"
|
||||
|
||||
if [ ! -f "$HOME/.zshrc" ]; then
|
||||
cp "/bootstrap/.zshrc" "$HOME/.zshrc"
|
||||
fi
|
17
docker/builder/root/bootstrap/entrypoint.sh
Executable file
17
docker/builder/root/bootstrap/entrypoint.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d /bootstrap/entrypoint.d ]; then
|
||||
for i in /bootstrap/entrypoint.d/*.sh; do
|
||||
if [ -r $i ]; then
|
||||
. $i
|
||||
fi
|
||||
done
|
||||
unset i
|
||||
fi
|
||||
|
||||
if [ ! -t 1 ] ; then
|
||||
echo "No tty available."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec "$@"
|
Reference in New Issue
Block a user