Skip to content

Docker container for conversion of env files to YAML files to be used with Google Cloud Run gcloud CLI

Notifications You must be signed in to change notification settings

joanfabregat/env2yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env2yaml

Docker container for conversion of env files to YAML files to be used with Google Cloud Run gcloud CLI. It is in particular design to be used with GitHub Actions et Google Cloud Build to deploy applications to Google Cloud Run.

This container is loosely based after this shell script by l2D.

The container is available on Docker Hub under the name joanfabregat/env2yaml.

Usage

As a standalone script:

curl -L -o env2yaml.sh https://raw.githubusercontent.com/joanfabregat/env2yaml/main/env2yaml.cjs 
node env2yaml.sh .env env.yaml

In a cloudbuild.yaml configuration file:

steps:
  # Build the container image
  - id: 'docker-build'
    name: 'gcr.io/cloud-builders/docker'
    args:
      - 'build'
      - '.'

  # Generation of the env.yaml file
  - id: 'env2yaml'
    name: 'joanfabregat/env2yaml'
    env:
      - 'INPUT_FILE=/workspace/.env'
      - 'OUTPUT_FILE=/workspace/.env.yaml'

  # Deploy container image to Cloud Run
  - id: 'deploy-to-cloudrun-staging'
    name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    args:
      - 'run'
      - 'deploy'
      - '--env-vars-file=/workspace/.env.yaml'

About

Docker container for conversion of env files to YAML files to be used with Google Cloud Run gcloud CLI

Resources

Stars

Watchers

Forks