diff --git a/Dockerfile b/Dockerfile index 1e58eba..9d6bfc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,13 +11,13 @@ USER app # Copy all needed project files to a folder COPY --chown=app ./.mvn/ .mvn -COPY --chown=app ./mvnw ./pom.xml ./app.json ./ +COPY --chown=app ./mvnw ./pom.xml ./ COPY --chown=app ./src ./src RUN curl -OL https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar # Build the production package -RUN ./mvnw --batch-mode clean verify -Pproduction -DskipTests +RUN ./mvnw --batch-mode clean verify -Pproduction -DskipTests # Running stage: the part that is used for running the application FROM eclipse-temurin:21-jre-noble @@ -28,10 +28,6 @@ USER app COPY --chown=app --from=build /usr/src/app/target/*.jar /usr/app/website.jar COPY --chown=app --from=build /usr/src/app/opentelemetry-javaagent.jar /usr/app/opentelemetry-javaagent.jar -ENV JAVA_TOOL_OPTIONS="-javaagent:/usr/app/opentelemetry-javaagent.jar" -ENV OTEL_SERVICE_NAME="website" -ENV OTEL_EXPORTER_OTLP_ENDPOINT="http://opentelemetry-collector.web:4318" - -HEALTHCHECK CMD curl --fail http://localhost:5000/actuator/health/liveness || exit 1 +HEALTHCHECK CMD curl --fail http://localhost:8080/actuator/health || exit 1 CMD ["java", "-jar", "/usr/app/website.jar"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d293235 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +REMOTE_HOST = mars3142@172.16.20.1 +PROJECT_NAME = firmware-hq +SERVICE_NAME = website +RASPI_PATH = /mnt/data/${PROJECT_NAME} + +install: build deploy import cleanup + +build: + docker buildx build --platform linux/arm64 --no-cache -t ${PROJECT_NAME}/${SERVICE_NAME}:latest -o type=docker,dest=./${SERVICE_NAME}-arm64.tar . + +deploy: + scp ./${SERVICE_NAME}-arm64.tar ${REMOTE_HOST}:${RASPI_PATH}/ + +import: + ssh ${REMOTE_HOST} "sudo docker load -i ${RASPI_PATH}/${SERVICE_NAME}-arm64.tar && rm ${RASPI_PATH}/${SERVICE_NAME}-arm64.tar" + +cleanup: + rm -f ${SERVICE_NAME}-arm64.tar + +.PHONY: build deploy import cleanup diff --git a/app.json b/app.json deleted file mode 100644 index ded8ad0..0000000 --- a/app.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "healthchecks": { - "web": [ - { - "type": "readiness", - "name": "web check", - "description": "Checking if the app responds to the /actuator/health/readiness endpoint", - "path": "/actuator/health/readiness", - "port": 5000, - "attempts": 3 - } - ] - } -}