-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from johnbedeir/dev
v1.13.1
- Loading branch information
Showing
4 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Deploy to production | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
deploy: | ||
name: Build image | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out 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: eu-central-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: nginx-docker | ||
IMAGE_TAG: nginx-v0.0.1 | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:latest | ||
|
||
RUN apt update -y | ||
|
||
EXPOSE 8080 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Github Actions Workflow to build and push docker image to AWS ECR | ||
|
||
## Step 1: | ||
Create AWS ECR Repository | ||
|
||
`NOTE: make sure to update the variable `**ECR_REPOSITORY: nginx-docker** [aws.yaml](https://github.com/johnbedeir/Github_Actions_Docker_ECR/blob/main/.github/workflows/aws.yaml#:~:text=ECR_REPOSITORY%3A-,nginx%2Ddocker,-IMAGE_TAG%3A%20nginx) ` with the repository name` | ||
|
||
## Step 2: | ||
Create github repository and create two Github Secrets using the following names and add your **IAM Access Key and Secret Accress Key** | ||
``` | ||
AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY | ||
``` | ||
|
||
## Step 3: | ||
Commit the following files you found in this repository | ||
|
||
1. Dockerfile | ||
2. .github/workflows.aws.yaml | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Build Kubernetes Cluster (EKS) using Terraform | ||
|
||
### This project is to build Kubernetes Cluster (EKS) on AWS using Terraform. | ||
|
||
**1. eks.tf** : AWS EKS resource and attache VPC | ||
|
||
**2. igw.tf** : Internet Gateway | ||
|
||
**3. nat.tf** : AWS Elastic IP and NAT gateway | ||
|
||
**4. nodes.tf** : EC2 (nodes) for the cluster | ||
|
||
**5. provider.tf** : AWS Provider | ||
|
||
**6. routes.tf** : Private and Public route tables | ||
|
||
**7. subnets.tf** : Private and Public subnets on different zones | ||
|
||
**8. vpc.tf** : Creating VPC | ||
|
||
|
||
## Step 1: | ||
``` | ||
terraform init | ||
``` | ||
## Step 2: | ||
``` | ||
terraform plan | ||
``` | ||
## Step 3: | ||
``` | ||
terraform apply -auto-approve | ||
``` |