From d264f039b97f5b8e8c8beff0c14163455d9b3fb2 Mon Sep 17 00:00:00 2001 From: tchawou-daniel Date: Sat, 16 Jan 2021 21:14:31 +0100 Subject: [PATCH] :construction_worker: add the config of docker-buildandpush --- .circleci/config.yml | 25 +++++++++++++++++++++++-- Dockerfile | 4 ++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 998c596..5702752 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,7 +34,7 @@ jobs: root: /tmp paths: - dist - front-deploy: + fondend-deploy: docker: - image: circleci/node:dubnium-browsers working_directory: ~/dist @@ -45,6 +45,24 @@ jobs: name: Deploy app command: | npx netlify-cli deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir /tmp/dist --prod + docker-buildandpush: + docker: + - image: docker:17.05.0-ce-git + steps: + - checkout + - setup_remote_docker + - run: + name: Build application Docker image + command: | + docker build --cache-from=app -t app . + - deploy: + name: Publish application to docker hub + command: | + docker login -e sipetchawoudanieljordan@yahoo.fr -u sipedaniel -p $DOCKER_HUB_PASSWORD + docker tag app sipedaniel/frontend-finalproject:$CIRCLE_BUILD_NUM + docker tag app sipedaniel/frontend-finalproject:latest + docker push sipedaniel/frontend-finalproject:$CIRCLE_BUILD_NUM + docker push sipedaniel/frontend-finalproject:latest workflows: version: 2.1 build-deploy_frontend: @@ -53,6 +71,9 @@ workflows: - build: requires: - install-dependencies - - front-deploy: + - fondend-deploy: + requires: + - build + - docker-buildandpush: requires: - build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2e12037 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM node:dubnium +COPY . /app +WORKDIR /app +CMD yarn global add node-gyp && yarn install && yarn start \ No newline at end of file