chore: Reduce steps to spin up Codespaces (#2576)

This commit is contained in:
Sojan Jose
2021-07-06 21:21:40 +05:30
committed by GitHub
parent 104ae8de2e
commit bbc47971d7
3 changed files with 8 additions and 6 deletions

View File

@@ -1,11 +1,8 @@
# The below image is created out of the Dockerfile.base
# It has the dependencies already installed so that codespace will boot up fast
FROM ghcr.io/sojan-official/chatwoot_codespace:latest
FROM ghcr.io/chatwoot/chatwoot_codespace:latest
# Do the set up required for chatwoot app
WORKDIR /workspace
COPY . /workspace
RUN yarn
COPY Gemfile Gemfile.lock ./
RUN gem install bundler && bundle install
RUN yarn && gem install bundler && bundle install

View File

@@ -29,7 +29,7 @@
// Use 'postCreateCommand' to run commands after the container is created.
// #TODO: can we move logic of copy env file into dockerfile ?
"postCreateCommand": "cp .env.example .env",
"postCreateCommand": ".devcontainer/scripts/setup.sh && bundle exec rake db:chatwoot_prepare && yarn",
"portsAttributes": {
"3000": {
"label": "Rails Server"

5
.devcontainer/scripts/setup.sh Executable file
View File

@@ -0,0 +1,5 @@
cp .env.example .env
sed -i -e '/REDIS_URL/ s/=.*/=redis:\/\/localhost:6379/' .env
sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env
sed -i -e '/SMTP_ADDRESS/ s/=.*/=localhost/' .env
sed -i -e "/FRONTEND_URL/ s/=.*/=https:\/\/$CODESPACE_NAME-3000.githubpreview.dev/" .env