Dockerize on CI

This commit is contained in:
Amit Jakubowicz 2019-07-26 15:32:11 +02:00
parent 4960e4f9a5
commit e190fddc04
9 changed files with 40 additions and 12 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
client/node_modules
server/node_modules

View File

@ -3,7 +3,6 @@ image: devillex/docker-firebase:latest
cache:
paths:
- node_modules/
- functions/node_modules/
deploy_staging:
stage: deploy
@ -11,8 +10,7 @@ deploy_staging:
only:
- master
script:
- make configure-functions-staging
- yarn
- (cd functions; yarn; yarn lint; yarn build)
- (yarn global add typescript)
- (cd webapp; yarn; yarn build)
- (cd server; yarn build)
- (cd client; yarn build)
- docker build -t registry.gitlab.com/amiiit/gcf-auth:$CI_COMMIT_SHA .

View File

@ -1,4 +1,31 @@
FROM devillex/docker-firebase:latest
FROM ubuntu:18.04
COPY . code/
RUN apt-get update
RUN apt-get install -y curl
# Node
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
# postgres
RUN apt-get install -y postgresql-10
# nginx
RUN apt-get install -y nginx
# application
RUN mkdir /opt/server
RUN mkdir /opt/client
COPY ./server/lib ./opt/server
COPY ./server/package.json /opt/server
COPY ./client/dist ./opt/client
COPY ./client/package.json ./opt/client
RUN (cd /opt/client; npm install)
RUN (cd /opt/server; npm install)
WORKDIR /opt
CMD node ./server/index.js

View File

@ -2,7 +2,7 @@
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc --version && tsc",
"build": "tsc --version && tsc; cp ./src/schema.graphql ./lib/",
"start": "nodemon --exec ts-node --files src/index.ts",
"test": "jest --runInBand",
"prod-server": "DB_USER=qpa DB_PASSWORD=qpa POSTGRES_DB=qpa forever start -v -c ts-node ./src/index.ts"

View File

@ -1,12 +1,12 @@
import {createTestClient} from 'apollo-server-testing'
import {createServer} from "../../graphql"
import {Connection, createConnection} from "typeorm"
import {testConfig} from "../../../ormconfig"
import {testConfig} from "../../ormconfig"
import gql from "graphql-tag"
import {PostOffice, sendEmail} from "../../post_office"
import {User} from "../User.entity"
import {Session, SessionInvite} from "../Session.entity"
import SessionManager from "../SessionManager";
import SessionManager from "../SessionManager"
jest.setTimeout(10000)

View File

@ -31,7 +31,7 @@ export const createServer = async (dependencies: Dependencies) => {
sessionManager: dependencies.sessionManager
})
const typeDefs = importSchema(__dirname + '/../../schema.graphql')
const typeDefs = importSchema(__dirname + '/schema.graphql')
const { Query: EventQueryResolvers, Mutation: EventResolversMutation,...eventResolvers} = EventsResolvers
const { Query: UserQueryResolvers, Mutation: UserMutationResolvers, ...userResolvers} = UserResolvers

View File

@ -1,5 +1,5 @@
import { createServer } from "./graphql"
import typeormConfig from '../ormconfig'
import typeormConfig from './ormconfig'
import {createConnection} from "typeorm"
import { sendEmail} from "./post_office"
import * as config from './config'