From 005a542e957faaa0d68d40c55c8bbaec4381404a Mon Sep 17 00:00:00 2001 From: verzelea Date: Sun, 17 Jan 2021 14:55:53 +0100 Subject: [PATCH] :whale: add Docker --- .circleci/config.yml | 23 +++++++++++++++++++++++ Dockerfile | 10 ++++++++++ src/common/config.js | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 85a2697..ee82952 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,7 @@ jobs: key: yarn-packages-{{ checksum "yarn.lock" }}-{{ .Environment.CACHE_VERSION }} paths: - node_modules + test: docker: - image: circleci/node:dubnium-browsers @@ -25,6 +26,7 @@ jobs: - run: name: Start test command: yarn test + build-in-prod: docker: - image: circleci/node:dubnium-browsers @@ -46,6 +48,26 @@ jobs: root: /tmp paths: - dist + + docker-build-push: + working_directory: /dockerapp + docker: + - image: docker:17.05.0-ce-git + steps: + - checkout + - setup_remote_docker + - run: + command: | + docker build --cache-from=app -t app . + - run: + name: Login and push to DockerHub + command: | + docker login -u grennrich -p $DOCKER_HUB_PASSWORD + docker tag app grennrich/devopstpfinal-front:$CIRCLE_BUILD_NUM + docker tag app grennrich/devopstpfinal-front:latest + docker push grennrich/devopstpfinal-front:$CIRCLE_BUILD_NUM + docker push grennrich/devopstpfinal-front:latest + deploy: docker: - image: circleci/node:dubnium-browsers @@ -58,6 +80,7 @@ jobs: command: | sudo npm install -g --silent netlify-cli netlify deploy --prod --auth $NETLIFY_TOKEN --dir=/tmp/dist --site $NETLIFY_SITE_ID + workflows: build_deploy: jobs: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..268e8c1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:dubnium + +WORKDIR /app + +RUN yarn install + +COPY . . + +EXPOSE 2020 +CMD ["yarn", "serve"] \ No newline at end of file diff --git a/src/common/config.js b/src/common/config.js index 71b53a0..a04266f 100644 --- a/src/common/config.js +++ b/src/common/config.js @@ -1,5 +1,5 @@ export const API_URL = process.env.NODE_ENV === "production" - ? process.env.PROD_BACK_URL || "URL_HERE" + ? process.env.PROD_BACK_URL || "https://devopstpfinal-front.herokuapp.com/api" : "http://localhost:2020/api"; export default API_URL;