From 40292a7383db09300e9d4796b108de41e751c250 Mon Sep 17 00:00:00 2001 From: Joe Bailey Date: Sun, 12 Feb 2023 18:52:07 -0800 Subject: [PATCH] Made changes to the docker file to get it working in ECS. (#3) * Made changes to the docker file to get it working in ECS. * Removed health check from the cloud formation template, since it is in the docker file now. --- Dockerfile | 8 ++++++++ infra/templates/service.yaml | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 12b89f4d0..6ffad5212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,11 @@ FROM openjdk:20-ea-17-jdk +VOLUME /tmp + COPY target/spring-petclinic-3.0.0-SNAPSHOT.jar spring-petclinic-3.0.0-SNAPSHOT.jar + +RUN useradd -d /home/appuser -m -s /bin/bash appuser +USER appuser + +HEALTHCHECK --interval=5m --timeout=3s CMD curl -f http://localhost:8080/ || exit 1 + ENTRYPOINT ["java","-jar","/spring-petclinic-3.0.0-SNAPSHOT.jar"] diff --git a/infra/templates/service.yaml b/infra/templates/service.yaml index a2d6cc5bf..c2a5a80e7 100644 --- a/infra/templates/service.yaml +++ b/infra/templates/service.yaml @@ -145,14 +145,12 @@ Resources: ContainerDefinitions: - Name: simple-app Image: !Sub ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${Repository}:${Tag} - # EntryPoint: - # - /usr/sbin/apache2 - # - -D - # - FOREGROUND Essential: true Memory: 512 PortMappings: - ContainerPort: 8080 + LogConfiguration: + - LogDriver: awslogs Environment: - Name: Tag Value: !Ref Tag