diff --git a/.app.config b/.app.config new file mode 100644 index 0000000..6289082 --- /dev/null +++ b/.app.config @@ -0,0 +1,16 @@ +{ + "ID": "cache", + "Name": "cache", + "Address": "__IP__", + "Tags": ["api-cache", "cache", "tcp", "redis"], + "Port": 6379, + "Connect": { + "Native": true + }, + "Check": { + "TCP": "__IP__:6379", + "Interval": "10s", + "Timeout": "10s", + "DeregisterCriticalServiceAfter": "5m" + } +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9e083c2..27bfb82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,21 @@ -FROM redis:7.0.7-alpine3.17 +FROM redis:alpine LABEL dev.egommerce.image.author="Piotr Biernat" LABEL dev.egommerce.image.vendor="Egommerce" LABEL dev.egommerce.image.service="api-cache" LABEL dev.egommerce.image.version="1.0" +USER root + +RUN apk update && apk add ca-certificates + COPY ./api-cache/etc/redis.conf /etc/redis.conf +COPY ./api-cache/entrypoint.sh / +COPY ./.app.config / EXPOSE 6379 -# USER redis +ENTRYPOINT ["/entrypoint.sh"] + +# USER redis CMD ["redis-server", "/etc/redis.conf"] diff --git a/Makefile b/Makefile index 63ae7d0..bf0fff6 100644 --- a/Makefile +++ b/Makefile @@ -7,5 +7,8 @@ build-image-dev: build-image-prod: - sh ${DEPLOY_DIR}/image-build.sh +push-image-dev: + - sh ${DEPLOY_DIR}/image-push.sh dev + push-image-prod: - sh ${DEPLOY_DIR}/image-push.sh diff --git a/api-cache/entrypoint.sh b/api-cache/entrypoint.sh new file mode 100755 index 0000000..4d76eeb --- /dev/null +++ b/api-cache/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +update-ca-certificates + +register-service +update-resolv + +exec "$@" diff --git a/deploy/image-build.sh b/deploy/image-build.sh index 2c80257..427fba2 100755 --- a/deploy/image-build.sh +++ b/deploy/image-build.sh @@ -1,7 +1,7 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_NAME="git.pbiernat.dev/egommerce/api-cache" +export IMAGE_NAME="git.pbiernat.io/egommerce/api-cache" TARGET=${1:-latest} diff --git a/deploy/image-push.sh b/deploy/image-push.sh index 1370a11..be7960d 100755 --- a/deploy/image-push.sh +++ b/deploy/image-push.sh @@ -1,9 +1,12 @@ #!/bin/sh # RUN IN REPO ROOT DIR !! -export IMAGE_NAME="git.pbiernat.dev/egommerce/api-cache" +export IMAGE_NAME="git.pbiernat.io/egommerce/api-cache" TARGET=${1:-latest} -echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin +echo $DOCKER_PASSWORD | docker login git.pbiernat.io -u $DOCKER_USERNAME --password-stdin docker push "$IMAGE_NAME:$TARGET" + +# Restart container +curl -X POST http://127.0.0.1:9001/api/webhooks/130a1299-ecbd-4057-b82b-16011b117716