Last active
September 22, 2019 06:39
-
-
Save kechol/34608f3c2d391170c1492f53d99b746f to your computer and use it in GitHub Desktop.
devcontainer for ruby2 and hanami setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"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" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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