This commit is contained in:
Piotr Biernat 2022-11-30 02:28:31 +01:00
commit e6261c6c6e
8 changed files with 98 additions and 0 deletions

36
.drone.yml Normal file
View File

@ -0,0 +1,36 @@
kind: pipeline
type: docker
name: default
steps:
- name: publish_image
image: plugins/docker
environment:
DOCKER_USERNAME:
from_secret: registry_username
DOCKER_PASSWORD:
from_secret: registry_password
commands:
- sleep 5
- ./deploy/image-build.sh
- ./deploy/image-push.sh
volumes:
- name: docker-sock
path: /var/run
when:
branch:
- main
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: docker-sock
path: /var/run
volumes:
- name: gopath
temp: {}
- name: docker-sock
temp: {}

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM rabbitmq:3-management-alpine
LABEL author="Piotr Biernat"
LABEL service="api-eventubus"
LABEL vendor="Egommerce"
LABEL version="1.0"
COPY ./api-eventbus/etc /etc/rabbitmq
RUN rabbitmq-plugins --offline enable rabbitmq_peer_discovery_consul
EXPOSE 5672

12
Makefile Normal file
View 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

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# api-eventbus
API Eventbus - RabbitMQ Queue

View File

@ -0,0 +1,5 @@
log.syslog = true
log.syslog.host = api-logger
log.syslog.port = 5140
log.default.level = warning

View File

@ -0,0 +1,7 @@
cluster_formation.peer_discovery_backend = consul
cluster_formation.consul.host = api-registry
cluster_formation.consul.svc_addr_auto = false
cluster_formation.consul.svc = api-eventbus
cluster_formation.consul.svc_addr = api-eventbus

16
deploy/image-build.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus"
TARGET=${1:-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."

7
deploy/image-push.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# RUN IN REPO ROOT DIR !!
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-eventbus"
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin
docker push "$IMAGE_NAME:latest"