From 0eff38199a49c5dca831e6a4f108816a07de31c9 Mon Sep 17 00:00:00 2001 From: Pat Heard Date: Wed, 6 Nov 2024 10:15:04 -0500 Subject: [PATCH] chore: rename containers to docker (#193) Update the Docker folder and associated workflows. --- .../{containers-apply.yml => docker-apply.yml} | 12 ++++++------ .../{containers-deploy.yml => docker-deploy.yml} | 4 ++-- .../{containers-pr.yml => docker-pr.yml} | 15 +++++++-------- .github/workflows/docker-vulnerability-scan.yml | 2 +- Makefile | 10 +++++----- README.md | 2 +- docker-compose.yml | 6 +++--- {containers => docker}/.env.local | 0 {containers => docker}/Dockerfile | 4 ++-- {containers => docker}/docker-bootstrap.sh | 0 {containers => docker}/docker-init.sh | 0 {containers => docker}/requirements.txt | 0 {containers => docker}/requirements_dev.txt | 0 {containers => docker}/superset_config.py | 0 14 files changed, 27 insertions(+), 28 deletions(-) rename .github/workflows/{containers-apply.yml => docker-apply.yml} (89%) rename .github/workflows/{containers-deploy.yml => docker-deploy.yml} (98%) rename .github/workflows/{containers-pr.yml => docker-pr.yml} (90%) rename {containers => docker}/.env.local (100%) rename {containers => docker}/Dockerfile (84%) rename {containers => docker}/docker-bootstrap.sh (100%) rename {containers => docker}/docker-init.sh (100%) rename {containers => docker}/requirements.txt (100%) rename {containers => docker}/requirements_dev.txt (100%) rename {containers => docker}/superset_config.py (100%) diff --git a/.github/workflows/containers-apply.yml b/.github/workflows/docker-apply.yml similarity index 89% rename from .github/workflows/containers-apply.yml rename to .github/workflows/docker-apply.yml index cd68a5b..0ee8b06 100644 --- a/.github/workflows/containers-apply.yml +++ b/.github/workflows/docker-apply.yml @@ -1,12 +1,12 @@ -name: Container build and push +name: Docker build and push on: push: branches: - main paths: - - "containers/**" - - ".github/workflows/containers-apply.yml" + - "docker/**" + - ".github/workflows/docker-apply.yml" env: AWS_REGION: ca-central-1 @@ -48,9 +48,9 @@ jobs: working-directory: ./ run: | docker build \ - --file ./containers/Dockerfile \ + --file ./docker/Dockerfile \ --tag $REGISTRY:sha-$GITHUB_SHA \ - --tag $REGISTRY:latest ./containers + --tag $REGISTRY:latest ./docker - name: Push Container to Amazon ECR run: | @@ -63,6 +63,6 @@ jobs: TRIVY_DB_REPOSITORY: ${{ vars.TRIVY_DB_REPOSITORY }} with: docker_image: "${{ env.REGISTRY }}:latest" - dockerfile_path: "./Dockerfile" + dockerfile_path: "./docker/Dockerfile" sbom_name: "cds-superset" token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/containers-deploy.yml b/.github/workflows/docker-deploy.yml similarity index 98% rename from .github/workflows/containers-deploy.yml rename to .github/workflows/docker-deploy.yml index 501c239..8dce2d7 100644 --- a/.github/workflows/containers-deploy.yml +++ b/.github/workflows/docker-deploy.yml @@ -1,4 +1,4 @@ -name: Containers deploy +name: Docker deploy on: workflow_run: @@ -16,7 +16,7 @@ permissions: id-token: write jobs: - containers-deploy: + docker-deploy: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/containers-pr.yml b/.github/workflows/docker-pr.yml similarity index 90% rename from .github/workflows/containers-pr.yml rename to .github/workflows/docker-pr.yml index 7dbef8a..b8c85af 100644 --- a/.github/workflows/containers-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -1,14 +1,13 @@ -name: Container Pull Request +name: Docker Pull Request on: pull_request: paths: - - "containers/**" - - ".github/workflows/containers-pr.yml" + - "docker/**" + - ".github/workflows/docker-pr.yml" jobs: - containers-hadolint: - + docker-hadolint: runs-on: ubuntu-latest permissions: contents: read # for actions/checkout to fetch code @@ -31,7 +30,7 @@ jobs: id: hadolint uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 with: - dockerfile: ./containers/Dockerfile + dockerfile: ./docker/Dockerfile format: sarif output-file: hadolint-results.sarif no-fail: true @@ -78,6 +77,6 @@ jobs: - name: Build Docker image run: | - docker build --file ./containers/Dockerfile \ + docker build --file ./docker/Dockerfile \ --tag ${{ github.repository }}:${{ github.sha }} \ - ./containers + ./docker diff --git a/.github/workflows/docker-vulnerability-scan.yml b/.github/workflows/docker-vulnerability-scan.yml index 16c9e27..30014f9 100644 --- a/.github/workflows/docker-vulnerability-scan.yml +++ b/.github/workflows/docker-vulnerability-scan.yml @@ -37,7 +37,7 @@ jobs: TRIVY_DB_REPOSITORY: ${{ vars.TRIVY_DB_REPOSITORY }} with: docker_image: "${{ env.REGISTRY }}:latest" - dockerfile_path: "./containers/Dockerfile" + dockerfile_path: "./docker/Dockerfile" token: ${{ secrets.GITHUB_TOKEN }} - name: Logout of Amazon ECR diff --git a/Makefile b/Makefile index c65749d..d865b0b 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,8 @@ apply: build: @docker build \ - --file ./containers/Dockerfile \ - --tag superset:latest ./containers + --file ./docker/Dockerfile \ + --tag superset:latest ./docker localhost: @docker compose up @@ -32,10 +32,10 @@ plan: --terragrunt-working-dir terragrunt install_dev: - @pip install -r ./containers/requirements_dev.txt + @pip install -r ./docker/requirements_dev.txt fmt: install_dev - black ./containers $(ARGS) + black ./docker $(ARGS) lint: install_dev - flake8 ./containers + flake8 ./docker diff --git a/README.md b/README.md index 635148a..88e8919 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A modern, enterprise-ready business intelligence web application. ## Setup ### AWS -1. Update the configuration in `./containers/superset_config.py`. +1. Update the configuration in `./docker/superset_config.py`. 2. Build the Docker image with `make build`. 3. Run Terraform apply with `make apply`. 4. Create the database and admin user: diff --git a/docker-compose.yml b/docker-compose.yml index 19c9403..b97b2a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,17 @@ x-superset-build: &superset-build - context: ./containers + context: ./docker dockerfile: Dockerfile x-superset-depends-on: &superset-depends-on - db - redis x-superset-env: &superset-env - - path: containers/.env.local + - path: docker/.env.local required: true x-superset-volumes: &superset-volumes - - ./containers:/app/docker + - ./docker:/app/docker - superset_home:/app/superset_home services: diff --git a/containers/.env.local b/docker/.env.local similarity index 100% rename from containers/.env.local rename to docker/.env.local diff --git a/containers/Dockerfile b/docker/Dockerfile similarity index 84% rename from containers/Dockerfile rename to docker/Dockerfile index 20a133b..903985f 100644 --- a/containers/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,7 @@ USER root # Add required database driver packages # https://superset.apache.org/installation.html#database-dependencies COPY requirements.txt /app/requirements.txt -RUN pip install --no-cache -r /app/requirements.txt +RUN pip install --no-cache-dir -r /app/requirements.txt ENV REQUIREMENTS_LOCAL=/app/requirements.txt # Custom bootstrap script @@ -13,6 +13,6 @@ COPY docker-bootstrap.sh /app/docker/docker-bootstrap.sh # Add custom configuration # https://superset.apache.org/docs/installation/configuring-superset/#configuring-superset COPY superset_config.py /app/superset_config.py -ENV SUPERSET_CONFIG_PATH /app/superset_config.py +ENV SUPERSET_CONFIG_PATH=/app/superset_config.py USER superset \ No newline at end of file diff --git a/containers/docker-bootstrap.sh b/docker/docker-bootstrap.sh similarity index 100% rename from containers/docker-bootstrap.sh rename to docker/docker-bootstrap.sh diff --git a/containers/docker-init.sh b/docker/docker-init.sh similarity index 100% rename from containers/docker-init.sh rename to docker/docker-init.sh diff --git a/containers/requirements.txt b/docker/requirements.txt similarity index 100% rename from containers/requirements.txt rename to docker/requirements.txt diff --git a/containers/requirements_dev.txt b/docker/requirements_dev.txt similarity index 100% rename from containers/requirements_dev.txt rename to docker/requirements_dev.txt diff --git a/containers/superset_config.py b/docker/superset_config.py similarity index 100% rename from containers/superset_config.py rename to docker/superset_config.py