Browse Source

Add DockerFile and Deploy to Docker 🚀

main
Adrien-Ba 4 years ago
parent
commit
cd72fbea3a
  1. 30
      .circleci/config.yml
  2. 11
      Dockerfile

30
.circleci/config.yml

@ -71,6 +71,27 @@ jobs:
exit 1 exit 1
fi fi
docker-build-and-push:
working_directory: /dockerapp
docker:
- image: docker:17.05.0-ce-git
steps:
- checkout
- setup_remote_docker:
version: 20.10.11
- 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 $DOCKERHUB_EMAIL -u $DOCKERHUB_USERID -p $DOCKERHUB_PASSWORD
docker tag app $DOCKERHUB_USERID/20212022devopsfinalbackend:$CIRCLE_BUILD_NUM
docker tag app $DOCKERHUB_USERID/20212022devopsfinalbackend:finalApp
docker push $DOCKERHUB_USERID/20212022devopsfinalbackend:$CIRCLE_BUILD_NUM
docker push $DOCKERHUB_USERID/20212022devopsfinalbackend:finalApp
workflows: workflows:
version: 2 version: 2
build-test-and-lint: build-test-and-lint:
@ -94,3 +115,12 @@ workflows:
filters: filters:
branches: branches:
only: main only: main
- docker-build-and-push:
requires:
- build
- lint
- back-test-e2e
- back-test-unit
filters:
branches:
only: main

11
Dockerfile

@ -0,0 +1,11 @@
FROM node:14.15.0
WORKDIR /repo
COPY . /repo
RUN yarn install
RUN yarn build
ENTRYPOINT [ "yarn", "start:prod" ]
Loading…
Cancel
Save