From d3a972211450b61b46d51aa57fa4377303bf90d4 Mon Sep 17 00:00:00 2001 From: Kamil Dubiel Date: Mon, 3 Feb 2025 18:05:58 +0100 Subject: [PATCH] Add Docker setup --- .dockerignore | 13 ++++++++++ .github/workflows/deploy_staging.yml | 4 --- .github/workflows/pr.yml | 1 + .secrets | 4 --- README.md | 39 ---------------------------- docker-compose.yml | 11 ++++++++ 6 files changed, 25 insertions(+), 47 deletions(-) create mode 100644 .dockerignore delete mode 100644 .secrets create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..06d315c5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +**/node_modules/ +**/build/ +**/dist/ +**/.next/ +**/tsconfig.tsbuildinfo + +**/Dockerfile* +**/.dockerignore + +**/*.log +**/.env* + +**/coverage-summary diff --git a/.github/workflows/deploy_staging.yml b/.github/workflows/deploy_staging.yml index 95efdac3..52de63c9 100644 --- a/.github/workflows/deploy_staging.yml +++ b/.github/workflows/deploy_staging.yml @@ -21,7 +21,3 @@ jobs: deploy_port: 229 secrets: SSH_PRIVATE_KEY: ${{ secrets.STAGING_KEY }} - VAULT_ADDR: ${{ secrets.VAULT_ADDR }} - VAULT_AUTH_METHOD: ${{ secrets.VAULT_AUTH_METHOD }} - VAULT_AUTH_ROLE_ID: ${{ secrets.VAULT_AUTH_ROLE_ID }} - VAULT_AUTH_SECRET_ID: ${{ secrets.VAULT_AUTH_SECRET_ID }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f6495916..230d8dcb 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -11,3 +11,4 @@ jobs: ci_steps: 'lint test' workflow: '.github/workflows/pr.yml' environment: 'staging' + package_manager: 'pnpm' diff --git a/.secrets b/.secrets deleted file mode 100644 index ac0c3c6a..00000000 --- a/.secrets +++ /dev/null @@ -1,4 +0,0 @@ ---- -:secrets_file: .env -:secrets_storage_key: js/js-react-example/ -:vault_addr: https://vault.byinfinum.co:8200 diff --git a/README.md b/README.md index 251ff106..34e61a1b 100644 --- a/README.md +++ b/README.md @@ -66,45 +66,6 @@ Project repository - [Infinum Handbook - Branching](https://infinum.com/handbook/frontend/git/branching) -## Secrets - -### Installation - -You need to install `secrets_cli` gem. Explained [here](https://github.com/infinum/secrets_cli) - -`gem install secrets_cli` - -### Configuration - -Create a new token on [GitHub](https://github.com/settings/tokens) with `read:org` permissions. - -Add 3 new environment variables to `.zshrc` file: - -``` -export VAULT_ADDR=https://vault.byinfinum.co:8200 -export VAULT_AUTH_METHOD=github -export VAULT_AUTH_TOKEN={your_github_token} -``` - -Don't forget to restart your `exec $SHELL` - -> Check the [secrets_cli prerequisites](https://github.com/infinum/secrets_cli#prerequisites) section for more details. - -### Pull the secrets - -Pull the secrets for the specific environment. Explained [here](https://github.com/infinum/secrets_cli#usage) - -`secrets pull -e development` - -### Vault dashboard - -Example link to Vault dashboard: - -- [development](https://vault.byinfinum.co:8200/ui/vault/secrets/js/show/js-react-example/development) -- [staging](https://vault.byinfinum.co:8200/ui/vault/secrets/js/show/js-react-example/staging) - -You should log in with the GitHub method and use VAULT_AUTH_TOKEN for the token. - ## Styleguide This project is using the styleguide as defined in the [Infinum Handbook](https://infinum.com/handbook/frontend/react/chakra-ui). diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..2ce04773 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + js-react-example: + image: infinum-js-react-example + container_name: infinum-js-react-example + build: + context: . + dockerfile: Dockerfile + env_file: + - ./.env.local + ports: + - '3000:3000'