diff --git a/docker-compose.yml b/docker-compose.yml index 72460ad..44894c0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,6 @@ version: '3.8' services: api: container_name: ionicapp_api - restart: unless-stopped depends_on: - postgres build: @@ -21,6 +20,24 @@ services: && rm -rf dist && npm run start:debug" + api-run: + container_name: ionicapp_api_run + restart: unless-stopped + depends_on: + - postgres + - redis + build: + context: docker/api + dockerfile: ./Dockerfile + user: "node" + tty: true + volumes: + - ./:/app + ports: + - ${PORT}:3000 + - ${DEBUG_PORT}:9229 + command: ["npm", "run", "start:prod"] + postgres: container_name: ionicapp_postgres restart: unless-stopped diff --git a/infra/lib/infra-stack.ts b/infra/lib/infra-stack.ts index 519aad8..4e52d2a 100644 --- a/infra/lib/infra-stack.ts +++ b/infra/lib/infra-stack.ts @@ -282,11 +282,11 @@ export class InfraStack extends cdk.Stack { `echo "BCRYPT_SALT_ROUNDS=8" >> .env`, // Start Docker Compose - 'sudo -u ec2-user /usr/local/bin/docker-compose up api postgres redis -d', + 'sudo -u ec2-user /usr/local/bin/docker-compose up api-run postgres redis -d', // Wait for services to start, then run migrations 'sleep 30', - 'sudo -u ec2-user /usr/local/bin/docker-compose exec -T api npm run migration:run', + 'sudo -u ec2-user /usr/local/bin/docker-compose exec -T api-run npm run migration:run', ); const keyPair = new ec2.CfnKeyPair(this, `${projectName}KeyPair`, { diff --git a/package-lock.json b/package-lock.json index ebdc80e..1a62282 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ionicapp", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ionicapp", - "version": "0.0.4", + "version": "0.0.5", "license": "UNLICENSED", "dependencies": { "@nestjs/common": "^11.0.1", diff --git a/package.json b/package.json index 467ed3f..23ffc24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ionicapp", - "version": "0.0.4", + "version": "0.0.5", "description": "", "author": "", "private": true,