stages:
  - build
  - deploy

variables:
  IMAGE_NAME: purwakarta-diskominfo-simedkom-new
  IMAGE_TAG: v1.0.0
  CONTAINER_NAME: purwakarta-diskominfo-simedkom-new

build:
  stage: build
  timeout: 60m
  image: docker:latest
  services:
    - docker:dind
  tags:
    - docker
  script:
    - docker info
    - docker build -t $IMAGE_NAME:$IMAGE_TAG .

deploy:
  stage: deploy
  timeout: 60m
  image: docker:latest
  services:
    - docker:dind
  tags:
    - docker
  before_script:
  - echo -e "$ENV_FILE" > .env
  script:
    - docker compose down || true
    - docker compose up -d
  only:
    - main
