trying to overcome openssl issue #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build and push a new container image to Amazon ECR | |
on: | |
push: | |
branches: ["release"] | |
name: Deploy to ECS - production | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: | |
name: Production | |
url: "https://app.plio.in" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Set current timestamp for image tag | |
id: timestamp | |
run: echo "::set-output name=timestamp::$(date +'%Y-%m-%d-%H-%M-%S')" | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
env: | |
NODE_ENV: production | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: plio-frontend-production | |
IMAGE_TAG: ${{ github.sha }}-${{ steps.timestamp.outputs.timestamp }} | |
VUE_APP_BACKEND: ${{ secrets.VUE_APP_BACKEND }} | |
VUE_APP_BACKEND_AUTH_URL: ${{ secrets.VUE_APP_BACKEND_AUTH_URL }} | |
VUE_APP_FRONTEND: ${{ secrets.VUE_APP_FRONTEND }} | |
VUE_APP_I18N_LOCALE: ${{ secrets.VUE_APP_I18N_LOCALE }} | |
VUE_APP_I18N_FALLBACK_LOCALE: ${{ secrets.VUE_APP_I18N_FALLBACK_LOCALE }} | |
VUE_APP_GOOGLE_CLIENT_ID: ${{ secrets.VUE_APP_GOOGLE_CLIENT_ID }} | |
VUE_APP_BACKEND_API_CLIENT_ID: ${{ secrets.VUE_APP_BACKEND_API_CLIENT_ID }} | |
VUE_APP_BACKEND_API_CLIENT_SECRET: ${{ secrets.VUE_APP_BACKEND_API_CLIENT_SECRET }} | |
VUE_APP_BACKEND_WEBSOCKET: ${{ secrets.VUE_APP_BACKEND_WEBSOCKET }} | |
VUE_APP_MIXPANEL_PROJECT_TOKEN: ${{ secrets.VUE_APP_MIXPANEL_PROJECT_TOKEN }} | |
VUE_APP_SENTRY_DSN: ${{ secrets.VUE_APP_SENTRY_DSN }} | |
VUE_APP_GOOGLE_API_KEY: ${{ secrets.VUE_APP_GOOGLE_API_KEY }} | |
NODE_OPTIONS: --openssl-legacy-provider | |
run: | | |
# Build a docker container and push it to ECR | |
docker build \ | |
--target production-stage \ | |
--build-arg NODE_ENV=$NODE_ENV \ | |
--build-arg VUE_APP_BACKEND=$VUE_APP_BACKEND \ | |
--build-arg VUE_APP_BACKEND_AUTH_URL=$VUE_APP_BACKEND_AUTH_URL \ | |
--build-arg VUE_APP_FRONTEND=$VUE_APP_FRONTEND \ | |
--build-arg VUE_APP_I18N_LOCALE=$VUE_APP_I18N_LOCALE \ | |
--build-arg VUE_APP_I18N_FALLBACK_LOCALE=$VUE_APP_I18N_FALLBACK_LOCALE \ | |
--build-arg VUE_APP_GOOGLE_CLIENT_ID=$VUE_APP_GOOGLE_CLIENT_ID \ | |
--build-arg VUE_APP_BACKEND_API_CLIENT_ID=$VUE_APP_BACKEND_API_CLIENT_ID \ | |
--build-arg VUE_APP_BACKEND_API_CLIENT_SECRET=$VUE_APP_BACKEND_API_CLIENT_SECRET \ | |
--build-arg VUE_APP_BACKEND_WEBSOCKET=$VUE_APP_BACKEND_WEBSOCKET \ | |
--build-arg VUE_APP_MIXPANEL_PROJECT_TOKEN=$VUE_APP_MIXPANEL_PROJECT_TOKEN \ | |
--build-arg VUE_APP_SENTRY_DSN=$VUE_APP_SENTRY_DSN \ | |
--build-arg VUE_APP_GOOGLE_API_KEY=$VUE_APP_GOOGLE_API_KEY \ | |
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
echo "Pushing image to ECR..." | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
- name: Download task definition | |
run: | | |
aws ecs describe-task-definition --task-definition plio-frontend-production --query taskDefinition > task-definition.json | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: task-definition.json | |
container-name: plio-frontend-production | |
image: ${{ steps.build-image.outputs.image }} | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: plio-frontend-production | |
cluster: plio-production-cluster | |
wait-for-service-stability: true |