From 53f88f4058e13d722b39f848e2823403cc9b896f Mon Sep 17 00:00:00 2001 From: Yusuke_Saito Date: Sun, 6 Sep 2020 08:25:06 +0200 Subject: [PATCH] update elixir/phx version, add DB and add pg_dump and mysqldump --- Dockerfile | 13 ++++++++++--- README.md | 4 ++-- docker-compose.yml | 29 ++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index e2869ce..11193ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM elixir:1.9.4 +FROM elixir:1.10.4 ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn ENV DEBIAN_FRONTEND noninteractive @@ -8,10 +8,17 @@ RUN apt-get update RUN apt-get -y upgrade RUN apt-get -y install git vim sudo inotify-tools -RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - +RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - RUN apt-get -y install nodejs +RUN sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +RUN sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +RUN apt-get update +RUN apt-get -y install postgresql-client-12 default-mysql-client + +RUN apt-get update && apt-get -y upgrade + ARG UID=1000 ARG GID=1000 @@ -27,4 +34,4 @@ WORKDIR /apps RUN mix local.hex --force RUN mix local.rebar --force -RUN mix archive.install --force hex phx_new 1.4.11 +RUN mix archive.install --force hex phx_new 1.5.5 diff --git a/README.md b/README.md index 6cf8de0..93905c4 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Docker を用いて Elixir/Phoenix アプリケーションの開発・学習を * Debian 10 (Buster) * Erlang/OTP 22.1.8 -* Elixir 1.9.4 -* Phoenix 1.4.11 +* Elixir 1.10.4 +* Phoenix 1.5.4 * Node.js 10.18 * npm 6.13 diff --git a/docker-compose.yml b/docker-compose.yml index b5715e1..5fe41ae 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,25 @@ -version: "3" +version: "3.1" services: + postgres: + image: postgres:12.4-alpine + environment: + POSTGRES_USER: phoenix + POSTGRES_PASSWORD: phoenix + POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --locale=ja_JP.UTF-8" + volumes: + - postgres_data:/var/lib/postgresql/data + + mysql: + image: mysql:8.0.21 + command: --default-authentication-plugin=mysql_native_password + environment: + MYSQL_ROOT_PASSWORD: example + MYSQL_USER: phoenix + MYSQL_PASSWORD: phoenix + MYSQL_DATABASE: nano_planner_dev + volumes: + - mysql_data:/var/lib/mysql + web: build: . command: bash @@ -11,4 +31,11 @@ services: working_dir: /apps ports: - "4000:4000" + depends_on: + - postgres + - mysql tty: true + +volumes: + postgres_data: + mysql_data: