Skip to content

Commit

Permalink
additional deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
ale210 committed Feb 8, 2025
1 parent c937cc0 commit 44851f8
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: deploy-dev
on:
push:
branches:
- issue_330_deploy_dev
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::035866691871:role/gha-incubator
role-session-name: ghaincubatorsession
aws-region: us-west-2

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


- name: Build, tag, and push the image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: people-depot-backend
IMAGE_TAG: dev
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
63 changes: 63 additions & 0 deletions app/Dockerfile-aws
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# pull official base image
FROM python:3.10-alpine

# set work directory
WORKDIR /usr/src/app

# set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# install system dependencies
RUN \
apk add \
'graphviz=~12'

# install font for graphviz
COPY Roboto-Regular.ttf /root/.fonts/
RUN fc-cache -f

# install dependencies
COPY ./requirements.txt .
# hadolint ignore=DL3042
RUN \
pip install uv==0.1.15 \
&& uv pip install --system -r requirements.txt


# copy project
COPY . .

# run entrypoint.sh
# Use the official Python runtime image
FROM python:3.13

# Create the app directory
RUN mkdir /app

# Set the working directory inside the container
WORKDIR /app

# Set environment variables
# Prevents Python from writing pyc files to disk
ENV PYTHONDONTWRITEBYTECODE=1
#Prevents Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1

# Upgrade pip
RUN pip install --upgrade pip

# Copy the Django project and install dependencies
COPY requirements.txt /app/

# run this command to install all dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the Django project to the container
COPY . /app/

# Expose the Django port
EXPOSE 8000

# Run Django’s development server
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]

0 comments on commit 44851f8

Please sign in to comment.