Hopefully maybe it will conisder to work @tommi27,Claudio told me to do so

This commit is contained in:
Jacob Salvi 2020-03-17 14:44:05 +01:00
parent b2503156a9
commit b2d94f337f
2 changed files with 61 additions and 2 deletions

View file

@ -3,6 +3,7 @@ image: node:latest
stages:
- build
- test
- deploy
cache:
paths:
@ -22,3 +23,22 @@ testing_testing:
script:
- cd smart-hut
- 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
View 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;"]