diff --git a/.circleci/config.yml b/.circleci/config.yml index fff7c76..2bca86f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,6 +12,12 @@ workflows: - db: requires: - build + - dockerhub: + requires: + - build + - lint + - tests + jobs: build: @@ -73,4 +79,22 @@ jobs: - save_cache: key: yarn-packages-v3{{ checksum "yarn.lock" }} paths: - - ./node_modules \ No newline at end of file + - ./node_modules + dockerhub: + environment: + IMAGE_NAME: jootha/devops-ci + docker: + - image: circleci/buildpack-deps:stretch + steps: + - checkout + - setup_remote_docker + - run: docker image build --tag $IMAGE_NAME:app . + + - run: + name: Publish Docker Image to Docker Hub + command: | + echo "$DOCKERHUB_PASS" | docker login -u alecomte -p a86a2e77-25ec-4cd2-b060-c55987957ca4 + docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM + docker tag $IMAGE_NAME:app $IMAGE_NAME:latest + + \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..ff16aed --- /dev/null +++ b/dockerfile @@ -0,0 +1,5 @@ +FROM node:12.18.4 +COPY ["package.json", "yarn.lock", "./"] +RUN yarn install +COPY . . +CMD ["yarn", "start"] \ No newline at end of file