Skip to content

Instantly share code, notes, and snippets.

# Git Strategy For Staging
Developers needs to merge feature branch in staging to do proper QA. Also CS people need to test feature in staging which turns it into an ever-growing tangle of unrelated, partially-tested features. So we need to do a periodic reset-to-main. If we miss a message of some developer saying "Hey can I reset staging?" and some feature is on tests by CS people so this would affect the QA process.
So, what if we make staging a deploy target and not a merge target?
Instead of developers merging their feature branch into `staging` and then push, we could create a github action that is triggered when we add a label in the PR like `deploy-to-staging`
```bash
name: Deploy to Staging

Generate a react app with docker and vite

To generate a react app using vite, just run the following command in a shell.

docker run --rm -it --user node  -w /app -v ${PWD}:/app node:18-slim npm create vite

Then you might add the following Dockerfile.dev to the project:

@alfredorico
alfredorico / generate_vue_app_with_docker.md
Created July 24, 2023 20:49
Creating a new Vue app with docker command

In order to generate a new Vue app without any node installation in the host machine we can run the following command:

docker run --rm -v "${PWD}:/app" -w "/app" -it node:18-slim \
bash -c "npm create vue@3 && chown -R $(id -u):$(id -g) ."

Because I'm using Linux, I need to run the "chown" command to change the ownership from root (docker generated files are owned by root) to my local user.

Run the following command to generate a new rails app without any ruby installation in the host machine. it just needs Docker.

export APP_NAME=myapp ; docker run --rm -v ${PWD}:/$APP_NAME -w /$APP_NAME -t ruby:slim \
sh -c "apt update && apt install -y --no-install-recommends git build-essential libpq-dev\
&& gem install -N rails -v '~>7' \
&& rails new $APP_NAME --database=postgresql --skip-system-test --skip-test \
&& chown -R $(id -u):$(id -g) $APP_NAME/"
@alfredorico
alfredorico / rubygem_with_docker.md
Last active October 17, 2023 14:13
Generate a Ruby gem with docker

This is an opinionated gist just to show that it's possible to start a ruby gem development work using Docker (I don't want any ruby installation in my manjaro laptop).

To generate a new gem in linux you can use the following command (if you're using MacOS there is no need to use --user flag):

docker run --rm -it -w /app -v ${PWD}:/app ruby:slim bash -c "bundle gem newgem && chown -R $(id -u):$(id -g) ./newgem" 

Then you can use the following Dockerfile to start the gem development work: