Skip to content

Option for using environment files #1

@shehzadashiq

Description

@shehzadashiq

If you wish to use .env files. I created the following files which you may wish to use.

Three files are required
repo_root.gitignore
repo_root.devcontainer\devcontainer.json
repo_root.devcontainer\devcontainer.env

The Dockerfile does not change

Values in files

*.gitignore

devcontainer.env

devcontainer.json

{
  "name": "Free AWS Cloud Bootcamp Development Environment",
  "build": { "dockerfile": "Dockerfile" },  

  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {}
  },

  "forwardPorts": [3000, 4567, 2000],

  "portsAttributes": {
    "3000": {
      "label": "Cruddur Frontend",
      "onAutoForward": "notify"
    },
    "4567": {
      "label": "Cruddur Backend",
      "onAutoForward": "notify"
    },
    "2000": {
      "label": "AWS X-Ray Daemon",
      "onAutoForward": "notify"
    }
  },

  "customizations": {      
    "vscode": {        
      "extensions": [
          "42Crunch.vscode-openapi",
          "ms-azuretools.vscode-docker",
          "ms-python.python",                                
          "hashicorp.terraform",
          "redhat.ansible",
          "redhat.vscode-yaml",
          "amazonwebservices.aws-toolkit-vscode"
      ]
    }
  },     
  
  "settings": {
		"terminal.integrated.profiles.linux": {
			"bash": {
				"path": "/usr/bin/bash",
				"icon": "terminal-bash"
			}
		},
		"terminal.integrated.defaultProfile.linux": "bash"
	},	
    
  "remoteUser": "bootcamp",

  "postAttachCommand": "cd ./frontend-react-js && npm install && cd ../backend-flask && pip install -r requirements.txt",

  "runArgs": ["--env-file",".devcontainer/devcontainer.env"]
}

sample.devcontainer.env
Named sample here so it can be placed in the repo and renamed when ready to use.

OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io/"
HONEYCOMB_API_KEY="VALUE"
AWS_DEFAULT_REGION="VALUE"
AWS_ACCESS_KEY_ID="VALUE"
AWS_SECRET_ACCESS_KEY="VALUE"
ROLLBAR_ACCESS_TOKEN="VALUE"
REACT_AWS_PROJECT_REGION="VALUE"
REACT_APP_AWS_COGNITO_IDENTITY_POOL_ID="VALUE"
REACT_APP_CLIENT_ID="VALUE"
REACT_APP_AWS_USER_POOLS_ID="VALUE"
REACT_AWS_PROJECT_REGION= "VALUE"
REACT_APP_AWS_COGNITO_REGION= "VALUE"
AWS_COGNITO_USER_POOL_ID="VALUE"
AWS_COGNITO_USER_POOL_CLIENT_ID="VALUE"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions