Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ecr-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Push Docker Image to ECR

on:
push:
branches:
- master
workflow_dispatch:


env:
AWS_REGION: ${{ secrets.AWS_REGION }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }} # Use the commit SHA as the image tag

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: . # Path to your Dockerfile context
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:latest
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ WORKDIR /src/backend/
RUN chmod -R 777 /src/backend/
RUN pip install Pillow legacy-cgi
RUN cd /src/backend/ && pip3 install -r requirements

CMD ["gunicorn", "e_store_primzel.settings"]
EXPOSE 8000
1 change: 1 addition & 0 deletions requirements
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ stripe # Latest version, no specific version required.
django_compressor # Latest version, no specific version required.
django-ses==3.5.2 # Updated to a newer version.
django-colorfield # Latest version, no specific version required.
gunicorn