Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntrnl 493 add new docker compose configuration #23

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PATH_SSL_PRIVATE_KEY="./infrastructure/host/test.key"
PATH_SSL_CERTIFICATE="./infrastructure/host/test.cert"
PATH_SSL_PRIVATE_KEY=./infrastructure/host/test.key
PATH_SSL_CERTIFICATE=./infrastructure/host/test.cert

PORT=3000
NODE_ENV=development

BASE_URL="http://localhost:3000"
CDN_HOST="d6nh3dxv55e16.cloudfront.net"
NODE_SSL_ENABLED="false"
BASE_URL=http://localhost:3000
CDN_HOST=test
NODE_SSL_ENABLED=false
Mouhajer-CO marked this conversation as resolved.
Show resolved Hide resolved

LOG_LEVEL=info
HUMAN=true
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: clean build lint test coverage docker-up docker-build

include .env

NODE_VERSION_SUPPORTED := >=20.0.0
NODE_VERSION=$(shell node -v)

Expand All @@ -17,8 +19,13 @@ docker-build:
docker compose -f docker-compose.yml build

docker-up:
$(info webapp starting)
ifeq ($(NODE_ENV),development)
$(info Building development environment)
docker compose -f docker-compose.yml -f ./infrastructure/docker/development/docker-compose.override.yml up
else
$(info Building production environment)
docker compose -f docker-compose.yml up
endif

lint:
npm run lint
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ services:
dockerfile: ./infrastructure/docker/${NODE_ENV}/Dockerfile
ports:
- "${PORT}:3000"
volumes:
- ./:/app
environment:
- NODE_ENV=${NODE_ENV}
- PATH_SSL_PRIVATE_KEY=${PATH_SSL_PRIVATE_KEY}
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/docker/development/docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: '3'
services:
web:
volumes:
- ./:/app
2 changes: 1 addition & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getEnvironmentValue } from '../utils/getEnvironmentValue';

export const PORT = getEnvironmentValue('PORT', '3000');
export const BASE_URL = getEnvironmentValue('BASE_URL', `http://localhost:${PORT}`);
export const CDN_HOST = getEnvironmentValue('CDN_HOST', 'd6nh3dxv55e16.cloudfront.net');
export const CDN_HOST = getEnvironmentValue('CDN_HOST');
export const NODE_SSL_ENABLED = getEnvironmentValue('NODE_SSL_ENABLED', 'false');

export const PATH_SSL_PRIVATE_KEY = getEnvironmentValue('PATH_SSL_PRIVATE_KEY', 'false');
Expand Down
1 change: 1 addition & 0 deletions test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export default () => {
process.env.LOG_LEVEL = 'info';
process.env.HUMAN = 'true';
process.env.TEST_KEY = 'test';
process.env.CDN_HOST = 'test';
process.env.UNSANITISED_TEST_KEY = ' test ';
};
Loading