Skip to content

Instantly share code, notes, and snippets.

@youknowcast
Last active November 14, 2023 02:25
Show Gist options
  • Save youknowcast/7df2991de81e7812585892bed201b91b to your computer and use it in GitHub Desktop.
Save youknowcast/7df2991de81e7812585892bed201b91b to your computer and use it in GitHub Desktop.
local environment(mysql + postgres + adminer)
version: '3.1'
services:
mysql-db:
image: mysql:8.1.0
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
volumes:
- mysql:/var/lib/mysql
postgres-db:
build: ./postgres
restart: always
environment:
POSTGRES_PASSWORD: password
POSTGRES_INITDB_ARGS: "--locale ja_JP.UTF-8"
ports:
- 5432:5432
volumes:
- postgres:/var/lib/postgresql/data
adminer:
image: adminer
restart: always
ports:
- 8080:8080
ruby-app:
build: ./ruby_app
volumes:
- ./ruby_app:/app
- bundle_data:/usr/local/bundle
depends_on:
- mysql-db
- postgres-db
volumes:
mysql:
postgres:
bundle_data:
% find .
.
./postgres
./postgres/Dockerfile
./ruby_app
./ruby_app/Dockerfile
./docker-compose.yml
# https://hub.docker.com/_/postgres/
FROM postgres:16.0
RUN apt-get update && apt-get install -y locales && \
sed -i -e 's/# ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG ja_JP.utf8
FROM ruby:3.2.2-slim-bullseye
# active_record の動作する最低限をインストール
RUN apt-get update -qq && apt-get install -y \
sqlite3 libsqlite3-dev \
build-essential \
vim \
locales \
libpq-dev \
postgresql-client \
default-libmysqlclient-dev \
default-mysql-client
RUN gem install bundler
RUN sed -i -E 's/# (ja_JP.UTF-8)/\1/' /etc/locale.gen && locale-gen
ENV LANG ja_JP.UTF-8
WORKDIR /app
COPY . .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment