initial
This commit is contained in:
commit
e7fa2a6589
36
.drone.yml
Normal file
36
.drone.yml
Normal 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: {}
|
17
Dockerfile
Normal file
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM hashicorp/consul:1.14
|
||||
|
||||
LABEL dev.egommerce.image.author="Piotr Biernat"
|
||||
LABEL dev.egommerce.image.vendor="Egommerce"
|
||||
LABEL dev.egommerce.image.service="api-registry"
|
||||
LABEL dev.egommerce.image.version="1.0"
|
||||
|
||||
COPY ./api-registry/etc /consul/config
|
||||
|
||||
RUN cat /usr/local/bin/docker-entrypoint.sh
|
||||
EXPOSE 8500 8600 8600/udp
|
||||
# USER consul
|
||||
|
||||
ENTRYPOINT ["consul", "agent", "-config-dir=/consul/config"]
|
||||
|
||||
# CMD ["consul", "agent", "-config-dir=/consul/config"]
|
||||
# ENTRYPOINT ["docker-entrypoint.sh"]
|
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
|
14
api-registry/etc/server.json
Normal file
14
api-registry/etc/server.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"node_name": "api-registry",
|
||||
"server": true,
|
||||
"bootstrap" : true,
|
||||
"ui_config": {
|
||||
"enabled" : true
|
||||
},
|
||||
"data_dir": "/consul/data",
|
||||
"addresses": {
|
||||
"http" : "0.0.0.0"
|
||||
},
|
||||
"bind_addr": "0.0.0.0",
|
||||
"advertise_addr": "127.0.0.1"
|
||||
}
|
16
deploy/image-build.sh
Executable file
16
deploy/image-build.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# RUN IN REPO ROOT DIR !!
|
||||
|
||||
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-registry"
|
||||
|
||||
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
7
deploy/image-push.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# RUN IN REPO ROOT DIR !!
|
||||
|
||||
export IMAGE_NAME="git.pbiernat.dev/egommerce/api-registry"
|
||||
|
||||
echo $DOCKER_PASSWORD | docker login git.pbiernat.dev -u $DOCKER_USERNAME --password-stdin
|
||||
docker push "$IMAGE_NAME:latest"
|
Loading…
Reference in New Issue
Block a user