Merge branch '34-cicd' into 'dev'
Resolve "CICD" Closes #34 See merge request sa4-2020/the-sanmarinoes/frontend!28
This commit is contained in:
commit
69822d3c53
2 changed files with 61 additions and 2 deletions
|
@ -3,6 +3,7 @@ image: node:latest
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
|
@ -22,3 +23,22 @@ testing_testing:
|
||||||
script:
|
script:
|
||||||
- cd smart-hut
|
- cd smart-hut
|
||||||
- yarn test
|
- yarn test
|
||||||
|
|
||||||
|
smartHut_deploy:
|
||||||
|
stage: deploy
|
||||||
|
# tags:
|
||||||
|
# - dind
|
||||||
|
image: docker:latest
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
variables:
|
||||||
|
DOCKER_DRIVER: overlay
|
||||||
|
before_script:
|
||||||
|
- docker version
|
||||||
|
- docker info
|
||||||
|
- docker login -u smarthutsm -p $CI_DOCKER_PASS #GiovanniRoberto
|
||||||
|
script:
|
||||||
|
- "docker build -t smarthutsm/smarthut:${CI_COMMIT_BRANCH} ."
|
||||||
|
- "docker push smarthutsm/smarthut:${CI_COMMIT_BRANCH}"
|
||||||
|
after_script:
|
||||||
|
- docker logout
|
||||||
|
|
39
Dockerfile
Normal file
39
Dockerfile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#FROM mhart/alpine-node:11 AS pleaseGodWork
|
||||||
|
#WORKDIR /app
|
||||||
|
#COPY . /app
|
||||||
|
#RUN ls
|
||||||
|
#RUN yarn run build
|
||||||
|
#
|
||||||
|
#RUN yarn global add serve
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#CMD ["serve", "-p", "8080", "-s", "."]
|
||||||
|
|
||||||
|
# base image
|
||||||
|
FROM node:9.6.1
|
||||||
|
RUN mkdir /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||||
|
|
||||||
|
|
||||||
|
COPY smart-hut/package.json /usr/src/app/package.json
|
||||||
|
RUN npm install --silent
|
||||||
|
RUN npm install react-scripts@1.1.1 -g --silent
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
|
FROM node:9.6.1 as builder
|
||||||
|
RUN mkdir /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||||
|
COPY smart-hut/package.json /usr/src/app/package.json
|
||||||
|
RUN npm install --silent
|
||||||
|
RUN npm install react-scripts@1.1.1 -g --silent
|
||||||
|
COPY smart-hut/. /usr/src/app
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM nginx:1.13.9-alpine
|
||||||
|
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
Loading…
Reference in a new issue