Commit 1b2223e1 authored by Nicholas J Anderson's avatar Nicholas J Anderson Committed by Zac Wood

Docker build in CI, use nginx for 'web' image

parent df77d0e7
stages:
- test
- build
test_api:
image: ruby:2.5
......@@ -16,4 +17,30 @@ test_web:
script:
- cd schedules_web
- yarn
- yarn build
\ No newline at end of file
- yarn build
build_web:
stage: build
retry: 2
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /root/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/schedules_web --dockerfile $CI_PROJECT_DIR/schedules_web/Dockerfile --destination $CI_REGISTRY_IMAGE/web:$CI_COMMIT_TAG
only:
- tags
build_api:
stage: build
retry: 2
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /root/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/schedules_api --dockerfile $CI_PROJECT_DIR/schedules_api/Dockerfile --destination $CI_REGISTRY_IMAGE/api:$CI_COMMIT_TAG
only:
- tags
version: "3.3"
volumes:
dbdata:
configs:
nginx_conf:
file: ./schedules_web/nginx.conf
networks:
front:
back:
services:
api:
image: registry.srct.gmu.edu/srct/schedules/api:0.1.0
networks:
back:
web:
image: registry.srct.gmu.edu/srct/schedules/web:0.1.0
networks:
front:
back:
volumes:
- ./schedules_web:/web
ports:
- 8085:80
......@@ -6,6 +6,8 @@ ADD . /api
EXPOSE 3000
ENV RAILS_ENV production
RUN bundle install
RUN rails db:migrate
RUN rails db:seed
FROM node:9
RUN mkdir /web
COPY . /web
WORKDIR /web
ADD . /web
EXPOSE 8080
RUN yarn install && yarn run build
RUN yarn
RUN yarn build
FROM nginx:1.15.0
COPY --from=0 /web/dist /web
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment