Compare commits
9 Commits
dev-mr-tes
...
main
Author | SHA1 | Date | |
---|---|---|---|
b6ac03b838 | |||
108a55c471 | |||
01a2061d70 | |||
af40a74b69 | |||
697feff582 | |||
8a560405ec | |||
f0959b135f | |||
02d67c0553 | |||
62c93a0c4c |
@ -1,6 +1,7 @@
|
|||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
LABEL author="Piotr Biernat"
|
LABEL author="Piotr Biernat"
|
||||||
|
LABEL service="api-gw"
|
||||||
LABEL vendor="Egommerce"
|
LABEL vendor="Egommerce"
|
||||||
LABEL version="1.0"
|
LABEL version="1.0"
|
||||||
|
|
||||||
|
12
Makefile
Normal file
12
Makefile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
DEPLOY_DIR := ./deploy
|
||||||
|
SRC_DIR := ./src
|
||||||
|
|
||||||
|
## DEPLOY PART
|
||||||
|
build-image-dev:
|
||||||
|
- sh ${DEPLOY_DIR}/image-build.sh dev
|
||||||
|
|
||||||
|
build-image-prod:
|
||||||
|
- sh ${DEPLOY_DIR}/image-build.sh
|
||||||
|
|
||||||
|
push-image-prod:
|
||||||
|
- sh ${DEPLOY_DIR}/image-push.sh
|
@ -2,7 +2,8 @@ include apigw_backends.conf;
|
|||||||
include apigw_keys.conf;
|
include apigw_keys.conf;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
access_log /var/log/nginx/apigw_access.log main;
|
access_log /var/log/nginx/apigw_access.log main;
|
||||||
|
error_log /var/log/nginx/apigw_error.log warn;
|
||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
# listen 443 ssl;
|
# listen 443 ssl;
|
||||||
@ -30,9 +31,6 @@ server {
|
|||||||
location = /_validate_apikey {
|
location = /_validate_apikey {
|
||||||
internal;
|
internal;
|
||||||
|
|
||||||
access_log /var/log/nginx/apigw_access.log main;
|
|
||||||
error_log /var/log/nginx/apigw_error.log warn;
|
|
||||||
|
|
||||||
if ($http_apikey = "") {
|
if ($http_apikey = "") {
|
||||||
return 401; # Unauthorized
|
return 401; # Unauthorized
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
|
|
||||||
export IMAGE_NAME="git.pbiernat.dev/egommerce/apigw-svc"
|
export IMAGE_NAME="git.pbiernat.dev/egommerce/apigw-svc"
|
||||||
|
|
||||||
branch=${DRONE_TAG:=$CI_COMMIT_BRANCH}
|
TARGET=${1:-latest}
|
||||||
branch=$(echo $branch | grep -v /) || echo $branch ;
|
|
||||||
p1=$(echo $branch | cut -d / -f1 -s) &&
|
|
||||||
p2=$(echo $branch | cut -d / -f2 -s) &&
|
|
||||||
tag=${branch:=$p1-$p2} &&
|
|
||||||
echo "Building" $tag
|
|
||||||
|
|
||||||
docker build --rm --cache-from "$IMAGE_NAME:latest" -t "$IMAGE_NAME:latest" .
|
echo "Building: $IMAGE_NAME:$TARGET"
|
||||||
|
if [ $TARGET = "dev" ]
|
||||||
|
then
|
||||||
|
docker build --rm --no-cache -t "$IMAGE_NAME:dev" . >/dev/null 2>&1
|
||||||
|
else
|
||||||
|
docker build --rm --cache-from "$IMAGE_NAME:$TARGET" -t "$IMAGE_NAME:$TARGET" . >/dev/null 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Done."
|
||||||
|
Loading…
Reference in New Issue
Block a user