mirror of
https://gitlab.com/mobicoop/v3/service/territory.git
synced 2025-12-30 20:02:39 +00:00
basic requirements
This commit is contained in:
15
ci/.env.ci
Normal file
15
ci/.env.ci
Normal 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
29
ci/Dockerfile
Normal 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
12
ci/wait-up.sh
Normal 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
|
||||
Reference in New Issue
Block a user