From f71e95787f06aca3068b89fb2cafff828e26777a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9nesis=20=C3=81lvarez?= Date: Wed, 13 Mar 2024 15:10:58 -0400 Subject: [PATCH] Codespaces (#181) * Fix: EOF standard * New: Create multiple docker-compose to manage different configurations * New:Adding dev containers configurations * Update: Documentation * New: Adding github codespaces --------- Co-authored-by: Genesis Alvarez Co-authored-by: Marluan Espiritusanto --- .devcontainer/devcontainer.json | 78 +++++++++++++++++++++++++++++++++ Dockerfile | 8 ++-- README.md | 45 +++++++++++++++++++ docker-compose.dev.yml | 36 +++++++++++++++ docker-compose.yml | 41 +++++++++++++++++ 5 files changed, 203 insertions(+), 5 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 docker-compose.dev.yml create mode 100644 docker-compose.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..11730bdf --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,78 @@ +{ + "name": "Cuenta Única Ciudadana", + "image": "node:lts", + "hostRequirements": { + "cpus": 5 + }, + "waitFor": "onCreateCommand", + "postAttachCommand": { + "server": "npm i" + }, + "postCreateCommand": "npm install --no-package-lock", + "forwardPorts": [3000], + "portsAttributes": { + "3000": { + "label": "Application", + "onAutoForward": "openPreview" + } + }, + "secrets": { + "PORT": { + "description": "The port where the server will be running" + }, + "AMPLIFY_WEBCLIENT_ID": { + "description": "The ID for the app client to be used by web applications" + }, + "AWS_EXPORTS_JS": { + "description": "Configuration file generated by the Amplify CLI tool when you initialize an AWS Amplify project" + }, + "AWS_EXPORTS_JSON": { + "description": "JSON file that contains configuration settings and environment variables related to AWS services within a specific project" + }, + "CEDULA_API": { + "description": "API endpoint responsible for operations related to user identity" + }, + "CEDULA_API_KEY": { + "description": "Authentication token or key used to access the API related to user identity" + }, + "CEDULA_TOKEN_API": { + "description": "Authentication token used to access the API related to user identity" + }, + "CITIZENS_API_AUTH_KEY": { + "description": "Authentication key used to access the API related to user identity" + }, + "ENCRYPTION_KEY": { + "description": "Key used for encrypting and decrypting data" + }, + "JCE_PHOTO_API": { + "description": "API endpoint responsible for operations related to user identity" + }, + "JCE_PHOTO_API_KEY": { + "description": "Authentication key used to access the API related to user identity" + }, + "NEXT_PUBLIC_GOOGLE_ANALYTICS": { + "description": "Used in Next.js applications to configure Google Analytics integration" + }, + "NEXT_PUBLIC_RECAPTCHA_SITE_KEY": { + "description": "Site key for integrating Google reCAPTCHA into a Next.js application" + }, + "ORY_SDK_TOKEN": { + "description": "Authentication token or access token used in conjunction with the ORY SDK" + }, + "ORY_SDK_URL": { + "description": "URL endpoint of an ORY software development kit (SDK)" + }, + "PWNED_KEY": { + "description": "Authentication key used to access the Have I Been Pwned (HIBP) service" + }, + "RECAPTHA_API_KEY": { + "description": "Key used for integrating reCAPTCHA services into web applications" + }, + "SENTRY_AUTH_TOKEN": { + "description": "Authentication token used in the context of the Sentry error monitoring and tracking platform" + }, + "SITE_COOKIE_KEY": { + "description": "Used in web development to manage and manipulate cookies within a website or web application" + } + } + } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b70b7c04..13c5f377 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,11 +54,9 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l # Rebuild the source code only when needed FROM base AS build -RUN <<". Al hacer clic en él, se mostrará el Explorador remoto. Desde allí, puede hacer clic derecho en el contenedor asociado con su proyecto y seleccionar `"Remote: Close Remote Conenction"`. Esta acción detendrá el contenedor asociado con su proyecto. Si desea iniciarlo de nuevo, puede utilizar el comando `"Dev Containers: Open Folder in Container"`. + +Tener en cuenta que detener el contenedor no lo eliminará; simplemente lo detiene. Si desea eliminar el contenedor por completo, puede hacerlo usando los comandos de Docker en la terminal o usando una herramienta GUI de Docker. + + ## Autor/es - **Gustavo Valverde** - _Product Manager_ - [@gustavovalverde](https://github.com/gustavovalverde) @@ -92,6 +136,7 @@ Este proyecto depende de las siguientes recursos externos: - **José Álvarez** - *Developer* - [@JE1999](https://github.com/JE1999) - **Jeffrey Mesa** - *Developer* - [@jeffreyart1](https://github.com/jeffreyart1) - **Deyvison García** - _UI/UX Designer_ - [@DeyvisonGarcia](https://github.com/DeyvisonGarcia) +- **Genesis Alvarez** - *DevOps* - [@UsernameAlvarez](https://github.com/UsernameAlvarez) ## Información adicional diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 00000000..35612023 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,36 @@ +version: '3.9' + +services: + cuenta_unica: + container_name: cuenta_unica + image: node + environment: + - CEDULA_API + - CEDULA_API_KEY + - JCE_PHOTO_API + - JCE_PHOTO_API_KEY + - ENCRYPTION_KEY + - RECAPTHA_API_KEY + - RECAPTHA_PROJECT_ID + - SITE_COOKIE_KEY + - NEXT_PUBLIC_RECAPTCHA_SITE_KEY + - NEXT_PUBLIC_GOOGLE_ANALYTICS + - CEDULA_TOKEN_API + - CITIZENS_API_AUTH_KEY + - ORY_SDK_URL + - NEXT_PUBLIC_ORY_SDK_URL + - ORY_SDK_TOKEN + - NEXT_PUBLIC_API_MOCKING + - LIVENESS_THRESHOLD_VALUE + - LIVENESS_SIMILARIY_VALUE + volumes: + - .:/app + ports: + - 3000:3000 + networks: + - cuenta_unica_network + tty: true + +networks: + cuenta_unica_network: + driver: bridge \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..10b73a51 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +version: '3.9' +services: + cuenta_unica: + container_name: cuenta_unica + build: + context: . + dockerfile: Dockerfile + args: + - SENTRY_ORG + - SENTRY_PROJECT + - SENTRY_AUTH_TOKEN + - NEXT_PUBLIC_SENTRY_DSN + - NEXT_PUBLIC_RECAPTCHA_SITE_KEY + restart: unless-stopped + networks: + - cuenta_unica_network + ports: + - 3000:3000 + environment: + - CEDULA_API + - CEDULA_API_KEY + - JCE_PHOTO_API + - JCE_PHOTO_API_KEY + - ENCRYPTION_KEY + - RECAPTHA_API_KEY + - RECAPTHA_PROJECT_ID + - SITE_COOKIE_KEY + - NEXT_PUBLIC_RECAPTCHA_SITE_KEY + - NEXT_PUBLIC_GOOGLE_ANALYTICS + - CEDULA_TOKEN_API + - CITIZENS_API_AUTH_KEY + - ORY_SDK_URL + - NEXT_PUBLIC_ORY_SDK_URL + - ORY_SDK_TOKEN + - NEXT_PUBLIC_API_MOCKING + - LIVENESS_THRESHOLD_VALUE + - LIVENESS_SIMILARIY_VALUE + - SENTRY_LOG_LEVEL=debug + +networks: + cuenta_unica_network: \ No newline at end of file