Skip to content

Commit

Permalink
Merge pull request #119 from Trycatch-tv/dev
Browse files Browse the repository at this point in the history
chore: inclusión de consctrucción de imagen docker en pipeline y habi…
  • Loading branch information
judlup authored Jun 6, 2024
2 parents 4127bc2 + 9d9337a commit 8cf4fe2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
region: ${{ secrets.AWS_REGION }}

- name: Build Docker image
run: docker build -t glasscamp-backend:latest .

- name: Tag Docker image
run: docker tag glasscamp-backend:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/glasscamp-backend:latest

- name: Push Docker image to Amazon ECR
run: docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/glasscamp-backend:latest

deploy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -50,8 +64,12 @@ jobs:
echo "NODE_ENV=${{secrets.NODE_ENV}}" >> .env
echo "POSTGRES_USER=${{secrets.POSTGRES_USER}}" >> .env
echo "POSTGRES_PASSWORD=${{secrets.POSTGRES_PASSWORD}}" >> .env
echo "POSTGRES_DB=${{secrets.POSTGRES_DB}}" >> .env
echo "POSTGRES_DB=${{secrets.POSTGRES_DB}}" >> .env
echo "AWS_ACCOUNT_ID=${{secrets.AWS_ACCOUNT_ID}}" >> .env
echo "AWS_REGION=${{secrets.AWS_REGION}}" >> .env
# Hacer pull de los cambios en la imagen docker
# docker pull ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/glasscamp-backend:latest
# Actualizar la imagen del servicio backend y reiniciarlo sin afectar db
docker-compose down
docker-compose up -d --no-deps --build
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ services:
- 5432:5432

backend:
build: .
# build: .
image: ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/glasscamp-backend:latest
# image: glasscamp-backend:latest
container_name: backend
env_file:
- .env
Expand Down

0 comments on commit 8cf4fe2

Please sign in to comment.