mirror of
https://github.com/nicolabs/nicobot.git
synced 2025-09-05 06:33:25 +02:00
+ sample configuration files to build & deploy to AWS
This commit is contained in:
parent
0ee4652b88
commit
22ec567660
|
@ -1,2 +1,2 @@
|
|||
**/.env
|
||||
**/*.env
|
||||
deploy
|
||||
|
|
2
.github/workflows/dockerhub.yml
vendored
2
.github/workflows/dockerhub.yml
vendored
|
@ -252,7 +252,7 @@ jobs:
|
|||
context: ./
|
||||
file: ./signal-debian.Dockerfile
|
||||
build-args: |
|
||||
NICOBOT_BASE_IMAGE=nicolabs/nicobot@${{ needs.build-publish-debian.outputs.digest }}
|
||||
NICOBOT_DEBIAN_FROM=nicolabs/nicobot@${{ needs.build-publish-debian.outputs.digest }}
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
platforms: linux/arm/v7,linux/arm64,linux/386,linux/amd64
|
||||
push: true
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -136,3 +136,5 @@ dmypy.json
|
|||
|
||||
nicobot/version.py*
|
||||
deploy
|
||||
**/*.env
|
||||
!tests/transbot-sample-conf/sample.env
|
||||
|
|
32
Makefile
32
Makefile
|
@ -1,3 +1,9 @@
|
|||
# Default values (override with .env file / environment variables)
|
||||
NICOBOT_IMAGE?= nicolabs/nicobot
|
||||
|
||||
check:
|
||||
echo ${NICOBOT_IMAGE}
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
@ -6,21 +12,33 @@ build:
|
|||
python3 setup.py build sdist bdist_wheel
|
||||
|
||||
docker-build-alpine:
|
||||
docker build -t nicolabs/nicobot:dev-alpine -f alpine.Dockerfile $(ARGS) .
|
||||
# E.g. ARGS="-v debug" make docker-build-alpine
|
||||
docker build -t ${NICOBOT_IMAGE}:dev-alpine -f alpine.Dockerfile $(ARGS) .
|
||||
|
||||
docker-build-debian:
|
||||
docker build -t nicolabs/nicobot:dev-debian -f debian.Dockerfile $(ARGS) .
|
||||
docker build -t ${NICOBOT_IMAGE}:dev-debian -f debian.Dockerfile $(ARGS) .
|
||||
|
||||
docker-build-debian-signal: docker-build-debian
|
||||
docker build -t nicolabs/nicobot:dev-signal-debian --build-arg NICOBOT_BASE_IMAGE=nicolabs/nicobot:dev-debian -f signal-debian.Dockerfile $(ARGS) .
|
||||
docker build -t ${NICOBOT_IMAGE}:dev-signal-debian --build-arg NICOBOT_DEPLOY_BASE_IMAGE=${NICOBOT_IMAGE}:dev-debian -f signal-debian.Dockerfile $(ARGS) .
|
||||
|
||||
docker-build-all: docker-build-debian docker-build-debian-signal docker-build-alpine
|
||||
|
||||
compose-build:
|
||||
cd aws && docker-compose -f transbot.docker-compose.yml build
|
||||
docker-compose -f tests/transbot-sample-conf/docker-compose.yml ${ARGS} build
|
||||
|
||||
compose-up:
|
||||
cd aws && docker-compose -f transbot.docker-compose.yml up --build
|
||||
docker-compose -f tests/transbot-sample-conf/docker-compose.yml ${ARGS} up --build
|
||||
|
||||
compose-down:
|
||||
docker-compose -f tests/transbot-sample-conf/docker-compose.yml ${ARGS} down
|
||||
|
||||
aws-up:
|
||||
# E.g. ARGS="--env-file /home/me/deploy/nicobot-aws-prod.env" make aws-up
|
||||
docker compose -f tests/transbot-sample-conf/docker-compose.yml ${ARGS} up
|
||||
|
||||
aws-down:
|
||||
# E.g. ARGS="--env-file /home/me/deploy/nicobot-aws-prod.env" make aws-down
|
||||
docker compose -f tests/transbot-sample-conf/docker-compose.yml ${ARGS} down
|
||||
|
||||
test:
|
||||
python3 -m unittest discover -v -s tests
|
||||
|
@ -32,10 +50,10 @@ transbot:
|
|||
python3 -m nicobot.transbot $(ARGS)
|
||||
|
||||
docker-askbot:
|
||||
docker run --rm -it nicobot:dev-signal-debian askbot $(ARGS)
|
||||
docker run --rm -it ${NICOBOT_IMAGE}:dev-signal-debian askbot $(ARGS)
|
||||
|
||||
docker-transbot:
|
||||
docker run --rm -it nicobot:dev-signal-debian transbot $(ARGS)
|
||||
docker run --rm -it ${NICOBOT_IMAGE}:dev-signal-debian transbot $(ARGS)
|
||||
|
||||
# All targets might be declared phony, since this Makefile is just a helper
|
||||
# However most just don't match a file/directory so they will work without it
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Global variables
|
||||
|
||||
# Change this var to build from a local dev image for instance
|
||||
ARG NICOBOT_BASE_IMAGE=nicolabs/nicobot:debian
|
||||
ARG NICOBOT_DEBIAN_FROM=nicolabs/nicobot:debian
|
||||
|
||||
|
||||
############################
|
||||
|
@ -101,7 +101,7 @@ RUN zip -d /opt/signal-cli/lib/zkgroup-java-*.jar libzkgroup.so
|
|||
# that inherits from the default nicobot (without signal support)
|
||||
#
|
||||
|
||||
FROM ${NICOBOT_BASE_IMAGE}
|
||||
FROM ${NICOBOT_DEBIAN_FROM}
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
|
|
11
tests/transbot-sample-conf/deploy.Dockerfile
Normal file
11
tests/transbot-sample-conf/deploy.Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
ARG NICOBOT_DEPLOY_BASE_IMAGE=nicolabs/nicobot:latest
|
||||
|
||||
FROM ${NICOBOT_DEPLOY_BASE_IMAGE}
|
||||
|
||||
# Overrides default configuration files with custom ones : i18n.*.yml, keywords.yml
|
||||
# Loads referentials to prevent the image to download them everytime it starts : languages.*.json, likelySubtags.json
|
||||
COPY i18n.*.yml \
|
||||
*.keywords.yml \
|
||||
languages.*.json \
|
||||
likelySubtags.json \
|
||||
/etc/nicobot/
|
24
tests/transbot-sample-conf/docker-compose.yml
Normal file
24
tests/transbot-sample-conf/docker-compose.yml
Normal file
|
@ -0,0 +1,24 @@
|
|||
# For AWS integration see https://docs.docker.com/cloud/ecs-integration
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
nicobot:
|
||||
image: ${NICOBOT_DEPLOY_IMAGE:-nicolabs/nicobot:mydeploy}
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ${NICOBOT_DEPLOY_DOCKERFILE:-deploy.Dockerfile}
|
||||
args:
|
||||
NICOBOT_DEPLOY_BASE_IMAGE: ${NICOBOT_DEPLOY_BASE_IMAGE:-nicolabs/nicobot:signal-debian}
|
||||
#image: nicolabs/nicobot:dev-signal-debian
|
||||
# Overrides the command line to point to the injected files/volumes
|
||||
command: "transbot --config-file /run/secrets/config.yml ${ARGS}"
|
||||
# Allows printing the QRCode to terminal in order to link with a Signal device
|
||||
# Not supported on AWS so look at the logs to get the URI to QR-encode
|
||||
tty: true
|
||||
secrets:
|
||||
- config.yml
|
||||
|
||||
secrets:
|
||||
# Injects the local 'config.yml' file into the container as a docker secret (/run/secrets/*)
|
||||
config.yml:
|
||||
file: ${NICOBOT_CONFIG_FILE:-./config.yml}
|
14
tests/transbot-sample-conf/sample.env
Normal file
14
tests/transbot-sample-conf/sample.env
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Nicobot config.yml file to use for deployment (will be loaded as a Docker secret)
|
||||
#NICOBOT_CONFIG_FILE=config.yml
|
||||
|
||||
# Base image to use to build the signal-debian variant
|
||||
#NICOBOT_DEBIAN_FROM=nicolabs/nicobot:dev-signal-debian
|
||||
|
||||
# Alternate Dockerfile to use for deployment (use it to override static and non-sensitive files directly in the image)
|
||||
#NICOBOT_DEPLOY_DOCKERFILE=deploy.Dockerfile
|
||||
|
||||
# Image to build FROM for deployment
|
||||
#NICOBOT_DEPLOY_BASE_IMAGE=nicolabs/nicobot:dev-signal-debian
|
||||
|
||||
# Image name to build specifically for deployment
|
||||
#NICOBOT_DEPLOY_IMAGE=nicolabs/nicobot:mydeploy
|
Loading…
Reference in a new issue