Skip to content

Commit

Permalink
docker config
Browse files Browse the repository at this point in the history
  • Loading branch information
vggonzal committed Oct 19, 2023
1 parent 14dcc4d commit 4aa8ad8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 52 deletions.
33 changes: 8 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
# Setup docker to build and push images
- name: Log in to the Container registry
# if: ${{ startsWith(github.ref, 'test') }}
#if: ${{ startsWith(github.ref, 'test') }}
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
Expand Down Expand Up @@ -213,31 +213,14 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
- run: aws sts get-caller-identity

- uses: hashicorp/[email protected]
with:
terraform_version: 1.0.3

- name: Deploy Terraform
#if: |
# github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/main' ||
# startsWith(github.ref, 'refs/heads/release') ||
# github.event.head_commit.message == '/deploy sit' ||
# github.event.head_commit.message == '/deploy uat'
working-directory: terraform/
- name: Validate Terraform
run: terraform validate -no-color

- name: Deploy to venue
id: terraform-deploy
working-directory: examples/cumulus-tf
env:
AWS_ACCESS_KEY_ID: ${{ secrets[format('AWS_ACCESS_KEY_ID_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_SERVICES_{0}', env.TARGET_ENV_UPPERCASE)] }}
AWS_DEFAULT_REGION: us-west-2

TF_VAR_hydrocron_api_api_docker_image: "ghcr.io/podaac/hydrocron:${{ env.THE_VERSION }}"

run: |
echo "--------"
echo ${{ env.THE_ENV }}
echo ${{ env.THE_VERSION }}
echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
terraform init -reconfigure -backend-config="bucket=podaac-services-sit-terraform" -backend-config="region=us-west-2"
terraform plan -var-file=tfvars/${{ env.THE_ENV }}.tfvars -var="app_version=${{ env.THE_VERSION }}" -out="tfplan"
terraform apply -auto-approve tfplan
./bin/deploy.sh --app-version ${{ env.THE_VERSION }} --tf-venue ${{ vars.TF_VENUE }} --lambda_container_image_uri ${{ env.CONTAINER_IMAGE_URI }}
7 changes: 7 additions & 0 deletions build-lambda-zip.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e

rm -rf dist/lambda-package || true
mkdir -p dist/lambda-package
cp -r ./hydrocron-api dist/lambda-package/
touch dist/lambda-package/hydrocron-api/__init__.py
26 changes: 0 additions & 26 deletions build.sh

This file was deleted.

1 change: 0 additions & 1 deletion terraform/hydrocron-main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ resource null_resource upload_ecr_image {
provisioner "local-exec" {
interpreter = ["/bin/bash", "-e", "-c"]
command = <<EOF
docker login ${data.aws_ecr_authorization_token.token.proxy_endpoint} -u AWS -p ${data.aws_ecr_authorization_token.token.password}
docker pull ${var.lambda_container_image_uri}
docker tag ${var.lambda_container_image_uri} ${aws_ecr_repository.lambda-image-repo.repository_url}:${local.ecr_image_tag}
docker push ${aws_ecr_repository.lambda-image-repo.repository_url}:${local.ecr_image_tag}
Expand Down

0 comments on commit 4aa8ad8

Please sign in to comment.