Skip to content

Instantly share code, notes, and snippets.

@kechol
Last active September 22, 2019 06:39
Show Gist options
  • Save kechol/34608f3c2d391170c1492f53d99b746f to your computer and use it in GitHub Desktop.
Save kechol/34608f3c2d391170c1492f53d99b746f to your computer and use it in GitHub Desktop.
devcontainer for ruby2 and hanami setup
{
"name": "app",
"dockerComposeFile": "docker-compose.yml",
"service": "api",
"workspaceFolder": "/workspace",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"solargraph.commandPath": "/usr/local/bundle/bin/solargraph"
},
"extensions": [
"rebornix.Ruby",
"castwide.solargraph"
]
}
version: "3"
services:
api:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ..:/workspace
- ../vendor:/vendor
environment:
DATABASE_URL: postgresql://app@db:5432/app_development
SERVE_STATIC_ASSETS: "true"
API_SESSIONS_SECRET: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
command: bash /workspace/.devcontainer/entrypoint.sh
ports:
- 2300:2300
links:
- db
db:
image: postgres:10.9-alpine
environment:
POSTGRES_USER: app
FROM ruby:2.6.4
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
ENV BUNDLE_JOBS=4 \
BUNDLE_PATH=/vendor/bundle
RUN apt-get update \
&& apt-get install -y git iproute2 procps postgresql \
&& gem install ruby-debug-ide solargraph debase \
&& gem install bundler hanami \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
#!/usr/bin/env bash
if [ -e Gemfile ]; then
bundle check || bundle install
fi
if [ -e rackup.pid ]; then
rm rackup.pid
fi
if [ -n "$DATABASE_HOST" ]; then
until echo < /dev/tcp/$DATABASE_HOST/5432; do
sleep 1
done
fi
bundle exec hanami server --host=0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment