basic requirements

This commit is contained in:
sbriat
2023-02-06 13:50:07 +01:00
parent bb5cd96bd9
commit a743fefe94
68 changed files with 18879 additions and 73 deletions

15
ci/.env.ci Normal file
View File

@@ -0,0 +1,15 @@
# SERVICE
SERVICE_URL=0.0.0.0
SERVICE_PORT=5004
# PRISMA
DATABASE_URL="postgresql://territory:territory@db:5432/territory?schema=public"
# RABBIT MQ
RMQ_URI=amqp://broker:5672
# MESSAGE BROKER
BROKER_IMAGE=rabbitmq:3-alpine
# POSTGRES
POSTGRES_IMAGE=postgis/postgis:15-3.3

29
ci/Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
###################
# BUILD FOR CI TESTING
###################
FROM node:18-alpine3.16
# Create app directory
WORKDIR /usr/src/app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
# Install app dependencies
RUN npm ci
# Bundle app source
COPY . .
# Generate prisma client
RUN npx prisma generate
# Create a "dist" folder
RUN npm run build
# Run unit tests
RUN npm run test:unit:ci
# Start the server
CMD [ "node", "dist/main.js" ]

12
ci/wait-up.sh Normal file
View File

@@ -0,0 +1,12 @@
#!/bin/bash
testlog() {
docker logs v3-territory-db-test | grep -q "database system is ready to accept connections"
}
testlog 2> /dev/null
while [ $? -ne 0 ];
do
sleep 5
echo "Waiting for Test DB to be up..."
testlog 2> /dev/null
done