From dd8db239d6f8b76e66b5cf77d5c90160decb9da9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 6 Dec 2022 23:40:23 +0100 Subject: [PATCH] Finished implementation of roulette --- roles/docker-roulette-wheel/handlers/main.yml | 6 +++--- roles/docker-roulette-wheel/tasks/main.yml | 20 ++++--------------- .../templates/Dockerfile.j2 | 5 ++--- roles/docker-roulette-wheel/vars/main.yml | 2 +- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/roles/docker-roulette-wheel/handlers/main.yml b/roles/docker-roulette-wheel/handlers/main.yml index afd97aed..96a4a963 100644 --- a/roles/docker-roulette-wheel/handlers/main.yml +++ b/roles/docker-roulette-wheel/handlers/main.yml @@ -1,8 +1,8 @@ --- -- name: setup roulette-wheel +- name: recreate and build roulette-wheel command: - cmd: docker-compose -p roulette-wheel up -d --force-recreate + cmd: docker-compose -p roulette-wheel up -d --force-recreate --build chdir: "{{docker_compose_path}}" environment: COMPOSE_HTTP_TIMEOUT: 600 - DOCKER_CLIENT_TIMEOUT: 600 + DOCKER_CLIENT_TIMEOUT: 600 \ No newline at end of file diff --git a/roles/docker-roulette-wheel/tasks/main.yml b/roles/docker-roulette-wheel/tasks/main.yml index 9a90212d..65cf9148 100644 --- a/roles/docker-roulette-wheel/tasks/main.yml +++ b/roles/docker-roulette-wheel/tasks/main.yml @@ -12,30 +12,18 @@ state: directory mode: 0755 -#- name: register directory -# stat: -# path: "{{docker_compose_path}}" -# register: docker_compose_path_register -# -#- name: checkout repository -# ansible.builtin.shell: git checkout . -# become: true -# args: -# chdir: "{{docker_compose_path}}" -# when: docker_compose_path_register.stat.exists - - name: pull app repository git: - repo: "https://github.com/p-wojt/roulette-wheel.git" + repo: "https://github.com/kevinveenbirkenbach/roulette-wheel.git" dest: "{{app_path}}" update: yes - notify: setup roulette-wheel + notify: recreate and build roulette-wheel become: true - name: add docker-compose.yml template: src=docker-compose.yml.j2 dest={{docker_compose_path}}docker-compose.yml - notify: setup roulette-wheel + notify: recreate and build roulette-wheel - name: add Dockerfile template: src=Dockerfile.j2 dest={{docker_compose_path}}Dockerfile - notify: setup roulette-wheel + notify: recreate and build roulette-wheel diff --git a/roles/docker-roulette-wheel/templates/Dockerfile.j2 b/roles/docker-roulette-wheel/templates/Dockerfile.j2 index 2ffeebcf..df9bb74b 100644 --- a/roles/docker-roulette-wheel/templates/Dockerfile.j2 +++ b/roles/docker-roulette-wheel/templates/Dockerfile.j2 @@ -1,8 +1,7 @@ FROM node:latest WORKDIR /app -COPY {{app_path}}package.json ./ +COPY ./app/package.json ./ RUN npm install -COPY {{app_path}} ./ +COPY ./app/ ./ RUN npm run build -EXPOSE 8080 CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/roles/docker-roulette-wheel/vars/main.yml b/roles/docker-roulette-wheel/vars/main.yml index d25db187..d63ac859 100644 --- a/roles/docker-roulette-wheel/vars/main.yml +++ b/roles/docker-roulette-wheel/vars/main.yml @@ -1,2 +1,2 @@ docker_compose_path: "/home/administrator/docker-compose/roulette-wheel/" -app_path: "/home/administrator/docker-compose/roulette-wheel/app" \ No newline at end of file +app_path: "/home/administrator/docker-compose/roulette-wheel/app/" \ No newline at end of file