diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98cb4ad..cdf3d22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,15 +2,15 @@ name: Test, Build, Publish, Release on: push: - branches: [main, staging, dev] + branches: [main, dev] pull_request: - branches: [main, staging, dev] + branches: [main, dev] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - # if branch is main, use prod, else staging or dev as necessary - BUILD_NAME: ${{ github.ref == 'refs/heads/main' && 'prod' || github.ref == 'refs/heads/staging' && 'staging' || 'dev' }} + # if branch is main, use prod, else dev + BUILD_NAME: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} jobs: test: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cfe31ab..c167b88 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,9 +13,9 @@ name: "CodeQL" on: push: - branches: [main, staging, dev] + branches: [main, dev] pull_request: - branches: [main, staging, dev] + branches: [main, dev] schedule: - cron: "26 3 * * 6" diff --git a/Dockerfile.staging b/Dockerfile.staging deleted file mode 100644 index 05ccd47..0000000 --- a/Dockerfile.staging +++ /dev/null @@ -1,49 +0,0 @@ -# https://fastapi.tiangolo.com/deployment/docker/#docker-image-with-poetry - -# First stage -FROM python:3.12.2-slim as requirements-stage - -# Set /tmp as the current working directory. -WORKDIR /tmp - -# Install Poetry -RUN pip install poetry - -# Copy the pyproject.toml and poetry.lock files to the /tmp directory. -COPY ./pyproject.toml ./poetry.lock* /tmp/ - -# Generate the requirements.txt file. -RUN poetry export -f requirements.txt --output requirements.txt --without-hashes - -# This is the final stage, anything here will be preserved in the final container image. -FROM python:3.12.2-slim - -# Install gcc and other dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - && rm -rf /var/lib/apt/lists/* - -# Set the current working directory to /code. -WORKDIR /code - -# Copy the requirements.txt file to the /code directory. -# This file only lives in the previous Docker stage, that's why we use --from-requirements-stage to copy it. -COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt - -# Install the package dependencies in the generated requirements.txt file. -RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt - -# Copy the app directory to the /code directory. -COPY ./app /code/app - -# Make port 80 available to the world outside this container -EXPOSE 80 - -# Healthcheck -HEALTHCHECK --interval=5s --timeout=5s --retries=3 \ - CMD curl -f http://localhost:8081/health || exit 1 - -# Run the uvicorn command, telling it to use the app object imported from app.main. -CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"] - -# CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"] diff --git a/README.md b/README.md index 74eddac..5a610dc 100644 --- a/README.md +++ b/README.md @@ -147,19 +147,17 @@ For other docker commands, see [useful_commands.md](./useful_commands.md) - [Git Graph](https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph) (free) - **Branches**: - `main` is the production mainline. - - `staging` is the staging line. - `dev` is the development line (***default branch***). - **PR merge strategy on Github** - Code should flow in the following direction through branches: ``` - feature/bug fix -> dev -> staging -> main + feature/bug fix -> dev -> main ``` - We'll be keeping a linear commit history and so using a combination of `Rebase and merge` and `Squash and merge` merge strategies. - Use `Rebase and merge` as ***default*** to ensure all commits from the branch to be merged are brought in individually to the target branch. - `Squash and merge` may be used ***ONLY*** when bringing in changes from a feature/bug fix branch into `dev`. - To maintain linear commit history, ensure to use `push force` when: - - Bringing `dev` on the same commit as `staging` (ie rebasing `dev` onto `staging`). - - Bringing `staging` on the same commit as `main` (ie rebasing `staging` onto `main`). + - Bringing `dev` on the same commit as `main` (ie rebasing `dev` onto `main`). - [More information on git rebase](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase). - [More information on PR merge strategies](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github). - **Jira issue linking** diff --git a/useful_commands.md b/useful_commands.md index 03f3ae8..2d6c199 100644 --- a/useful_commands.md +++ b/useful_commands.md @@ -71,7 +71,6 @@ docker ps ```sh docker build --file Dockerfile.dev --tag backend-dev . -docker build --file Dockerfile.staging --tag backend-staging . docker build --file Dockerfile.prod --tag backend-prod . ``` @@ -79,7 +78,6 @@ docker build --file Dockerfile.prod --tag backend-prod . ```sh docker run --name backend-dev --publish 8081:8081 backend-dev --detach -docker run --name backend-staging --publish 80:80 backend-staging --detach docker run --name backend-prod --publish 80:80 backend-prod --detach ``` @@ -87,7 +85,6 @@ docker run --name backend-prod --publish 80:80 backend-prod --detach ```sh docker stop backend-dev -docker stop backend-staging docker stop backend-prod ``` @@ -95,7 +92,6 @@ docker stop backend-prod ```sh docker restart backend-dev -docker restart backend-staging docker restart backend-prod ```