From bbc47971d7f08f834ff2f3fdce7c6b4f0f60b6ff Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Tue, 6 Jul 2021 21:21:40 +0530 Subject: [PATCH] chore: Reduce steps to spin up Codespaces (#2576) --- .devcontainer/Dockerfile | 7 ++----- .devcontainer/devcontainer.json | 2 +- .devcontainer/scripts/setup.sh | 5 +++++ 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100755 .devcontainer/scripts/setup.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8e6bc0acf..e3eb2fd01 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -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 \ No newline at end of file +RUN yarn && gem install bundler && bundle install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 194a9d909..ec85426d7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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" diff --git a/.devcontainer/scripts/setup.sh b/.devcontainer/scripts/setup.sh new file mode 100755 index 000000000..6030d93b1 --- /dev/null +++ b/.devcontainer/scripts/setup.sh @@ -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