Skip to content

Commit

Permalink
Added github action and dockerfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-br committed Apr 22, 2024
1 parent a963fdd commit c933a84
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Deploy to AWS ECR

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
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: us-west-2

- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: true

- name: Build, Tag, and Push Docker image to ECR
run: |
docker build -t clearsettleengine .
docker tag counter_web 211125762589.dkr.ecr.us-west-2.amazonaws.com/repo:clearsettleengine
docker push 211125762589.dkr.ecr.us-west-2.amazonaws.com/repo:clearsettleengine
env:
AWS_DEFAULT_REGION: us-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Trigger Deployment
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: tim-br/counter_k8s
event-type: deploy-clearsettleengine-event
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Use an official Elixir runtime as a parent image
FROM elixir:latest

# Create and set the working directory
WORKDIR /app

# Copy the mix.exs and mix.lock files to the container
COPY mix.exs mix.lock ./

# Install hex and rebar

RUN mix archive.install github hexpm/hex branch latest --force

RUN mix local.rebar --force
# Install dependencies
RUN mix deps.get

# Copy the rest of your application's code
COPY . .

# Compile the project

RUN mix do compile

# Run the application
CMD ["mix", "run"]

0 comments on commit c933a84

Please sign in to comment.