-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create aws.yml * Update aws.yml * Create .aws.task-definition.json * Update aws.yml * Update aws.yml * Update aws.yml * mv task definition JSON * Update aws.yml * mv task def * rename task def * Update task-definition.json * Update task-definition.json * Update aws.yml & task-definition.json * Update aws.yml * Update Dockerfile * Update task-definition.json with EntryPoint * Update task-definition.json * Update aws.yml * Update aws.yml * Update Dockerfile * Update aws.yml & task-definition.json * Update aws.yml & task-definition.json * Update aws.yml & task-definition.json * Update aws.yml & task-definition.json * Update task-definition.json * Update Dockerfile & task-definition.json * Update Dockerfile & task-definition.json * Update Dockerfile & task-definition.json * Update task-definition.json * Update aws.yml * Update aws.yml * Attempt new conf * Attempt conf fix * Revert changes * Update task-definition.json * Update task-definition.json * Update task-definition.json * Update run.sh & Dockerfile * Update run.sh & Dockerfile * Update Dockerfile * Update run.sh & Dockerfile * Update Dockerfile * Update Dockerfile, aws.yml & docker-image.yml * Update Dockerfile * Update Dockerfile * Update prot references * Update .aws/task-definition.json * Update task-definition.json * Update task-definition.json * Update ports * Update .aws/task-definition.json * Update port refs * Update Dockerfile * Update aws.yml & README.md
- Loading branch information
1 parent
ecd5dc5
commit 4eb373b
Showing
5 changed files
with
174 additions
and
25 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,90 @@ | ||
{ | ||
"taskDefinitionArn": "arn:aws:ecs:eu-north-1:345594590074:task-definition/ironoc:latest", | ||
"containerDefinitions": [ | ||
{ | ||
"name": "ironoc", | ||
"image": "345594590074.dkr.ecr.eu-north-1.amazonaws.com/conorheffron/ironoc:latest", | ||
"memory": "512", | ||
"portMappings": [ | ||
{ | ||
"name": "ironoc-80-tcp", | ||
"containerPort": 8080, | ||
"hostPort": 80, | ||
"protocol": "tcp", | ||
"appProtocol": "http" | ||
} | ||
], | ||
"essential": true, | ||
"environment": [], | ||
"mountPoints": [], | ||
"volumesFrom": [], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-group": "/ecs/ironoc", | ||
"mode": "non-blocking", | ||
"awslogs-create-group": "true", | ||
"max-buffer-size": "25m", | ||
"awslogs-region": "eu-north-1", | ||
"awslogs-stream-prefix": "ecs" | ||
} | ||
}, | ||
"systemControls": [] | ||
} | ||
], | ||
"family": "ironoc", | ||
"taskRoleArn": "arn:aws:iam::345594590074:role/ecsTaskExecutionRole", | ||
"executionRoleArn": "arn:aws:iam::345594590074:role/ecsTaskExecutionRole", | ||
"networkMode": "bridge", | ||
"volumes": [], | ||
"status": "ACTIVE", | ||
"requiresAttributes": [ | ||
{ | ||
"name": "com.amazonaws.ecs.capability.logging-driver.awslogs" | ||
}, | ||
{ | ||
"name": "ecs.capability.execution-role-awslogs" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.ecr-auth" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.28" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.task-iam-role" | ||
}, | ||
{ | ||
"name": "ecs.capability.execution-role-ecr-pull" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" | ||
}, | ||
{ | ||
"name": "ecs.capability.task-eni" | ||
}, | ||
{ | ||
"name": "com.amazonaws.ecs.capability.docker-remote-api.1.29" | ||
} | ||
], | ||
"placementConstraints": [], | ||
"compatibilities": [ | ||
"EC2", | ||
"FARGATE" | ||
], | ||
"requiresCompatibilities": [ | ||
"EC2" | ||
], | ||
"cpu": null, | ||
"memory": null, | ||
"runtimePlatform": { | ||
"cpuArchitecture": "X86_64", | ||
"operatingSystemFamily": "LINUX" | ||
}, | ||
"registeredAt": "2024-09-08T21:13:30.158Z", | ||
"registeredBy": "arn:aws:iam::345594590074:root", | ||
"tags": [] | ||
} |
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,75 @@ | ||
name: Deploy to Amazon ECS | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
env: | ||
AWS_REGION: eu-north-1 | ||
ECR_REPOSITORY: conorheffron/ironoc | ||
ECS_SERVICE: IronocService | ||
ECS_CLUSTER: IronocPortfolioCluster | ||
ECS_TASK_DEFINITION: .aws/task-definition.json | ||
CONTAINER_NAME: ironoc | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml | ||
|
||
- 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: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Fill in the new image ID in the Amazon ECS task definition | ||
id: task-def | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ${{ env.ECS_TASK_DEFINITION }} | ||
container-name: ${{ env.CONTAINER_NAME }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Deploy Amazon ECS task definition | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: ${{ steps.task-def.outputs.task-definition }} | ||
service: ${{ env.ECS_SERVICE }} | ||
cluster: ${{ env.ECS_CLUSTER }} | ||
wait-for-service-stability: true |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
FROM eclipse-temurin:21-jdk | ||
|
||
VOLUME /tmp | ||
#for local | ||
#ADD target/*.war app.war | ||
#for CI/CD | ||
ADD *.war app.war | ||
|
||
COPY target/*.war app.war | ||
RUN sh -c 'touch /app.war' | ||
|
||
ENV RUN_FILE /run.sh | ||
ADD run.sh ${RUN_FILE} | ||
COPY run.sh ${RUN_FILE} | ||
RUN chmod +x ${RUN_FILE} | ||
|
||
ENTRYPOINT [ "sh", "-c", "${RUN_FILE}" ] | ||
EXPOSE 8080 | ||
|
||
ENTRYPOINT [ "sh", "-c", "${RUN_FILE}" ] |
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