-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from tarebyte/tarebyte/create-devcontainer
Add a Development Container for a more seamless local experience
- Loading branch information
Showing
15 changed files
with
452 additions
and
160 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:jammy | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | ||
|
||
# disable installing recommended packages to save space | ||
RUN echo "APT::Install-Recommends \"false\";" > /etc/apt/apt.conf | ||
|
||
RUN apt-get update && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
libffi-dev \ | ||
libjemalloc-dev \ | ||
libpq-dev \ | ||
libreadline-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
libyaml-dev \ | ||
python2 \ | ||
shared-mime-info \ | ||
tmux \ | ||
zlib1g-dev && \ | ||
apt-get autoremove -y | ||
|
||
# Install Overmind to run multiple processes at once. | ||
RUN curl --fail --location --output /usr/bin/overmind.gz "https://github.com/DarthSim/overmind/releases/download/v2.4.0/overmind-v2.4.0-linux-$(dpkg --print-architecture).gz" && \ | ||
curl --fail --location --output /tmp/overmind.gz.sha256sum "https://github.com/DarthSim/overmind/releases/download/v2.4.0/overmind-v2.4.0-linux-$(dpkg --print-architecture).gz.sha256sum" && \ | ||
echo $(cat /tmp/overmind.gz.sha256sum) /usr/bin/overmind.gz | sha256sum --check --status && \ | ||
gunzip /usr/bin/overmind.gz && \ | ||
chmod +x /usr/bin/overmind | ||
|
||
# Run as the target user | ||
# Uses the username created by the VSCode devcontainer Ubuntu base image | ||
USER vscode | ||
ENV USER=vscode | ||
|
||
COPY ../.ruby-version /tmp/.ruby-version | ||
|
||
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv | ||
RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | ||
RUN ~/.rbenv/bin/rbenv install $(cat /tmp/.ruby-version) | ||
|
||
ENV OVERMIND_SOCKET=/tmp/.overmind.sock | ||
|
||
# https://github.com/devcontainers/templates/blob/4653d4cd09e27c57b3a03969e7d9cb8de313df19/src/ruby-rails-postgres/.devcontainer/Dockerfile#L6C1-L8C89 | ||
# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service | ||
# The value is a comma-separated list of allowed domains | ||
ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev,.preview.app.github.dev,.app.github.dev" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "Soulmedicine", | ||
"dockerComposeFile": [ | ||
"../docker-compose.yml", | ||
"docker-compose.yml" | ||
], | ||
"service": "workspace", | ||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||
"postCreateCommand": ".devcontainer/post-create-command.sh", | ||
"forwardPorts": [ | ||
1025, | ||
1080, | ||
3000, | ||
5432, | ||
6379, | ||
6380 | ||
], | ||
"portsAttributes": { | ||
"1025": { | ||
"label": "Mailcatcher - 1" | ||
}, | ||
"1080": { | ||
"label": "Mailcatcher - 2" | ||
}, | ||
"3000": { | ||
"label": "Web" | ||
}, | ||
"5432": { | ||
"label": "PostgreSQL" | ||
}, | ||
"6379": { | ||
"label": "Redis - Sidekiq" | ||
}, | ||
"6380": { | ||
"label": "Redis - Caching" | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"configureZshAsDefaultShell": true, | ||
"nonFreePackages": true | ||
}, | ||
"ghcr.io/devcontainers/features/github-cli:1": { | ||
"installDirectlyFromGitHubRelease": true, | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/node:1": { | ||
"version": "10.13" | ||
}, | ||
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { | ||
"plugins": "git npm nvm rbenv ssh-agent zsh-autosuggestions", | ||
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions" | ||
} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"kaiwood.endwise", | ||
"LoranKloeze.ruby-rubocop-revived", | ||
"ms-azuretools.vscode-docker", | ||
"ms-vscode-remote.remote-containers", | ||
"rebornix.Ruby" | ||
] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3.7' | ||
|
||
services: | ||
workspace: | ||
build: | ||
context: . | ||
dockerfile: .devcontainer/Dockerfile | ||
|
||
environment: | ||
DATABASE_HOST: postgres | ||
REDIS_URL: redis://redis-sidekiq:6379 | ||
REDIS_CACHE_URL: redis://redis-cache:6380 | ||
|
||
volumes: | ||
- ..:/workspaces:cached | ||
|
||
command: /bin/sh -c "while sleep 1000; do :; done" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Create .env.local with defaults if it doesn't already exist. | ||
if [ ! -f .env.local ] | ||
then | ||
touch .env.local | ||
|
||
cat <<EOT >> .env.local | ||
# Only necessary for devcontainers | ||
REDIS_URL="redis://redis-sidekiq:6379" | ||
REDIS_CACHE_URL="redis://redis-cache:6380" | ||
STORYBLOK_TOKEN="..." | ||
# Firebase Authentication | ||
FIREBASE_PROJECT_ID="..." | ||
FIREBASE_API_KEY="..." | ||
# Rollbar (only if you want to test errors are being reported locally) | ||
# SERVER_ROLLBAR_ACCESS_TOKEN="..." # Identified on rollbar as post_server_item | ||
# CLIENT_ROLLBAR_ACCESS_TOKEN="..." # Identified on rollbar as post_client_item | ||
# ROLLBAR_ENV=dev | ||
GOOGLE_ANALYTICS_ID="..." | ||
EOT | ||
fi | ||
|
||
gem install bundler:1.17.3 | ||
rbenv rehash | ||
|
||
npm update -g npm | ||
npm install -g yarn | ||
|
||
./bin/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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
ruby-2.7.8 | ||
2.7.8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "bin/server - run the server", | ||
"type": "shell", | ||
"command": "./bin/server", | ||
"group": "build", | ||
"presentation": { | ||
"panel": "dedicated", | ||
} | ||
}, | ||
{ | ||
"label": "bundle exec rspec - run the tests", | ||
"type": "shell", | ||
"command": "bundle exec rspec", | ||
"group": { | ||
"kind": "test", | ||
"isDefault": true | ||
}, | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
web: bundle exec puma -C config/puma.rb -p 3000 | ||
worker: bundle exec sidekiq -c 1 | ||
webpack-dev-server: bin/webpack-dev-server |
Oops, something went wrong.