ecommerce-website/docker-compose.yml

62 lines
1.9 KiB
YAML

version: '3.8'
services:
node:
build:
context: ./
dockerfile: Dockerfile
image: cosc304-node
container_name: cosc304-node
volumes:
- ./:/app/
- /app/node_modules
networks:
network304:
aliases:
- cosc304_node
ports:
- 80:3000
cosc304-sqlserver:
image: mcr.microsoft.com/mssql/server:2019-latest
container_name: cosc304-sqlserver
restart: always
environment:
ACCEPT_EULA: 'Y'
SA_PASSWORD: '304#sa#pw'
ports:
- '1433:1433'
expose:
- '1433'
volumes:
- cosc304-db:/var/lib/mssql
- ./ddl:/scripts
networks:
network304:
aliases:
- cosc304_sqlserver
command:
- /bin/bash
- -c
- |
/opt/mssql/bin/sqlservr &
pid=$$!
echo "Waiting for MS SQL to be available"
/opt/mssql-tools/bin/sqlcmd -l 30 -S localhost -h-1 -V1 -U sa -P $$SA_PASSWORD -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , @@servername"
is_up=$$?
while [ $$is_up -ne 0 ] ; do
echo -e $$(date)
/opt/mssql-tools/bin/sqlcmd -l 30 -S localhost -h-1 -V1 -U sa -P $$SA_PASSWORD -Q "SET NOCOUNT ON SELECT \"YAY WE ARE UP\" , @@servername"
is_up=$$?
sleep 5
done
for foo in /scripts/SQLServer*.ddl
do /opt/mssql-tools/bin/sqlcmd -U sa -P $$SA_PASSWORD -l 30 -e -i $$foo
done
trap "kill -15 $$pid" SIGTERM
wait $$pid
exit 0
volumes:
cosc304-db:
mysql-db:
networks:
network304: