@@ -14,9 +14,9 @@ build-api-docker-image:
14
14
15
15
.PHONY : build-migrations-docker-image
16
16
build-migrations-docker-image :
17
- docker build -t ghcr.io/kesha123/nodejs-rest-api/migrations:$(MIGRATIONS_IMAGE_TAG ) +
18
- -f ./data/docker/Dockerfile \
19
- ./data
17
+ docker build -t ghcr.io/kesha123/nodejs-rest-api/migrations:$(MIGRATIONS_IMAGE_TAG ) \
18
+ -f ./data/docker/Dockerfile \
19
+ ./data
20
20
21
21
22
22
.PHONY : generate-tls-certificates
@@ -27,25 +27,26 @@ generate-tls-certificates:
27
27
openssl req -new -text -passout pass:${PASSPHRASE} -subj /CN=${COMMON_NAME} -out ${SSL_DIR} /server.req -keyout ${SSL_DIR} /privkey.pem
28
28
openssl rsa -in ${SSL_DIR} /privkey.pem -passin pass:${PASSPHRASE} -out ${SSL_DIR} /server.key
29
29
openssl req -x509 -in ${SSL_DIR} /server.req -text -key ${SSL_DIR} /server.key -out ${SSL_DIR} /server.crt
30
+ @cp ${SSL_DIR} /server.key ${SSL_DIR} /server.key.bak
31
+ @sudo chown 999:999 ${SSL_DIR} /server.key
30
32
@sudo chmod 600 ${SSL_DIR} /server.key
31
33
32
34
33
- .PHONY : export-tls-certificates-to-env
34
- export-tls-certificates-to-env :
35
- @echo " Exporting TLS certificates to environment variables..."
36
- @mkdir -p $(shell pwd) /infrastructure/docker
37
- @echo " SSL_CERTIFICATE=$( shell cat $( SSL_DIR) /server.crt) " >> $(shell pwd) /infrastructure/docker/.env
38
- @echo " SSL_KEY=$( shell cat $( SSL_DIR) /server.key) " >> $(shell pwd) /infrastructure/docker/.env
39
- @echo " SSL_CA=$( shell cat $( SSL_DIR) /server.crt) " >> $(shell pwd) /infrastructure/docker/.env
40
-
41
-
42
35
.PHONY : database-start-local
43
36
database-start-local :
44
- docker compose -f ./infrastructure/docker/docker-compose.database.yml up -d
45
- docker exec -t nodejs-rest-api_postgres sh -c " psql -U postgres -d postgres -f /opt/sql/insert.sql"
37
+ docker compose -f $(shell pwd) /infrastructure/docker/docker-compose.database.yml up -d
38
+ docker run \
39
+ -ti \
40
+ --rm \
41
+ --env-file $(shell pwd) /infrastructure/docker/.env \
42
+ --network docker_nodejs-rest-api \
43
+ --volume $(shell pwd) /infrastructure/docker/ssl/privkey.pem:/migrations/ssl/privkey.pem \
44
+ --volume $(shell pwd) /infrastructure/docker/ssl/server.crt:/migrations/ssl/server.crt \
45
+ --volume $(shell pwd) /infrastructure/docker/ssl/server.key.bak:/migrations/ssl/server.key \
46
+ ghcr.io/kesha123/nodejs-rest-api/migrations:${MIGRATIONS_IMAGE_TAG}
47
+ docker exec postgres sh -c " psql -U postgres -d postgres -f /opt/sql/insert.sql"
46
48
47
49
48
50
.PHONY : api-start-local
49
51
api-start-local :
50
- docker compose -f ./infrastructure/docker/docker-compose.yml up -d
51
- docker exec -t nodejs-rest-api_postgres sh -c " psql -U postgres -d postgres -f /opt/sql/insert.sql"
52
+ docker compose -f $(shell pwd) /infrastructure/docker/docker-compose.yaml up -d
0 commit comments