Improve the current docker development environment.

This commit is contained in:
Andrey Antukh 2019-09-20 17:31:03 +02:00
parent affb1480ce
commit e45ad2197a
8 changed files with 126 additions and 56 deletions

View file

@ -2,6 +2,7 @@ FROM ubuntu:bionic
LABEL maintainer="Andrey Antukh <niwi@niwi.nz>"
ARG EXTERNAL_UID=1000
ARG DEBIAN_FRONTEND=noninteractive
ENV NODE_VERSION=v10.16.3 \
CLOJURE_VERSION=1.10.1.469 \
@ -37,7 +38,6 @@ RUN set -ex; \
echo "deb http://repos.azulsystems.com/ubuntu stable main" >> /etc/apt/sources.list.d/zulu.list; \
echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/postgresql.list;
ARG DEBIAN_FRONTEND=noninteractive
RUN set -ex; \
apt-get -qq update; \
@ -86,9 +86,10 @@ RUN set -ex; \
COPY files/bashrc /home/uxbox/.bashrc
COPY files/zshrc /home/uxbox/.zshrc
COPY files/vimrc /home/uxbox/.vimrc
COPY files/start.sh /home/uxbox/start-tmux.sh
COPY files/start.sh /home/uxbox/start.sh
COPY files/tmux.conf /home/uxbox/.tmux.conf
COPY files/entrypoint.sh /home/uxbox/
COPY files/init.sh /home/uxbox/
ENTRYPOINT ["zsh", "/home/uxbox/entrypoint.sh"]
CMD ["/home/uxbox/start-tmux.sh"]
CMD ["/home/uxbox/start.sh"]

View file

@ -0,0 +1,55 @@
version: '3'
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.177.09.0/24
volumes:
postgres_data:
user_data:
services:
uxbox:
privileged: true
build:
context: ./
hostname: 'uxbox-devenv'
container_name: 'uxbox-devenv'
command: "/home/uxbox/init.sh"
stop_signal: SIGINT
depends_on:
- postgres
volumes:
- "user_data:/home/uxbox/local"
- "${PWD}:/home/uxbox/uxbox"
- "${HOME}/.m2:/home/uxbox/.m2"
- "${HOME}/.gitconfig:/home/uxbox/.gitconfig"
ports:
- 3449:3449
- 6060:6060
environment:
- UXBOX_HTTP_SERVER_DEBUG=false
- UXBOX_DATABASE_URI="jdbc:postgresql://postgres/uxbox"
- UXBOX_DATABASE_USERNAME="uxbox"
- UXBOX_DATABASE_PASSWORD="uxbox_postgres_password"
postgres:
image: postgres:11
hostname: 'uxbox-devenv-postgres'
container_name: 'uxbox-devenv-postgres'
restart: always
stop_signal: SIGINT
ports:
- 5432:5432
environment:
- POSTGRES_INITDB_ARGS="--data-checksums"
- POSTGRES_DB=uxbox
- POSTGRES_USER=uxbox
- POSTGRES_PASSWORD=uxbox_postgres_password
volumes:
- postgres_data:/var/lib/postgresql/data

View file

@ -1,5 +1,3 @@
#!/usr/bin/env zsh
set -ex
sudo pg_ctlcluster 11 main start
exec "$@"

8
docker/devenv/files/init.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env zsh
set -e;
echo "[init.sh] Setting up local permissions."
sudo chown -R uxbox /home/uxbox/local
echo "[init.sh] Ready!"
tail -f /dev/null

View file

@ -10,7 +10,7 @@ tmux send-keys -t uxbox 'clojure -Adev tools.clj figwheel' enter
tmux new-window -t uxbox:2 -n 'backend'
tmux select-window -t uxbox:2
tmux send-keys -t uxbox 'cd uxbox/backend' enter C-l
tmux send-keys -t uxbox 'clojure -Adev -m uxbox.fixtures' enter C-l
# tmux send-keys -t uxbox 'clojure -Adev -m uxbox.fixtures' enter C-l
tmux send-keys -t uxbox 'clojure -Adev:repl' enter
tmux rename-window -t uxbox:0 'gulp'

View file

@ -47,7 +47,7 @@ setopt NOBEEP
setopt INC_APPEND_HISTORY
export HISTSIZE=100000
export SAVEHIST=100000
export HISTFILE=~/.zhistory
export HISTFILE=~/local/.zhistory
setopt hist_ignore_all_dups
setopt hist_ignore_space