Commit 575d7fc1 authored by Noel Alonso's avatar Noel Alonso
Browse files

Cambia variable de puerto y mueve healthcheck

Ahora todos tienen el mismo puerto por defecto.
Se pasa el healthcheck del docker-compose al Dockerfile
parent 575ba8b5
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
ARG PARENT_IMAGE_NAME
ARG PARENT_IMAGE_TAG
ARG PARENT_IMAGE_NAME=registry.gitlab.com/redmic-project/docker/redmic-server
ARG PARENT_IMAGE_TAG=latest

FROM ${PARENT_IMAGE_NAME}:${PARENT_IMAGE_TAG}

COPY /dist/*.jar ./

EXPOSE ${MICROSERVICE_PORT}
ARG PORT=8080
EXPOSE ${PORT}

HEALTHCHECK \
	--interval=30s \
	--timeout=15s \
	--start-period=3m \
	--retries=10 \
CMD wget --spider -q http://localhost:${PORT}/api/${MICROSERVICE_NAME}/actuator/health
+1 −1
Original line number Diff line number Diff line
MICROSERVICE_NAME=template
MICROSERVICE_PORT=port
PORT=8080
+0 −4
Original line number Diff line number Diff line
@@ -2,10 +2,6 @@ version: '3.5'

services:
  template:
    ports:
      - target: ${MICROSERVICE_PORT}
        published: ${MICROSERVICE_PORT}
        mode: host
    deploy:
      resources:
        limits:
+3 −9
Original line number Diff line number Diff line
@@ -2,28 +2,22 @@ version: '3.5'

services:
  template:
    image: ${IMAGE_NAME}:${IMAGE_TAG:-latest}
    image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/server/template/microservice-template}:${IMAGE_TAG:-latest}
    environment:
      - PORT
      - MICROSERVICE_NAME
      - MICROSERVICE_PORT
      - SPRING_PROFILES_ACTIVE
      - JAVA_OPTS=-XX:MaxRAMFraction=2
    networks:
      - metric-net
      - traefik-net
    healthcheck:
      test: wget --spider -q http://localhost:${MICROSERVICE_PORT}/api/${MICROSERVICE_NAME}/actuator/health
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 2m
    deploy:
      mode: replicated
      replicas: 1
      labels:
        traefik.frontend.rule: PathPrefix:/api/${MICROSERVICE_NAME}
        traefik.backend: ${MICROSERVICE_NAME}
        traefik.port: '${MICROSERVICE_PORT}'
        traefik.port: '${PORT}'
      restart_policy:
        delay: 10s
        window: 3m