Skip to content

Commit

Permalink
add Docker and docker-compose, update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cageyv committed Sep 10, 2021
1 parent 3e35ec9 commit 23230a7
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.*
env
setup.sh
test.sh
README.md
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.8-alpine

RUN apk add --no-cache --virtual .tmp-packeges build-base \
&& pip install dumb-init==1.2.5\
&& apk del .tmp-packeges

RUN apk add --no-cache git

RUN mkdir /app
COPY requirements.txt /app/
RUN pip install -r /app/requirements.txt

COPY . /app/

RUN addgroup -S app && adduser -S -G app app
RUN chown -R app:app /app
USER app

WORKDIR /app
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["python3", "/app/main.py"]
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ Deployment confiramtion button for Slack

Configuration is done via env variables

* `SLACK_BOT_TOKEN` - Slack bot token. Mandatory parameter. scopes: channels:history, chat:write, reactions:read
* `SLACK_BOT_TOKEN` - Slack bot token. Mandatory parameter. scopes: channels:history, chat:write, reactions:read, users:read.email, users:read
* `SLACK_APP_TOKEN` - Slack app token. Mandatory parameter. scopes: connections:write

# Slack App manifect example
```yaml
_metadata:
major_version: 1
minor_version: 1
display_information:
name: MagicButton
description: Deployment confirmation
background_color: "#2645a3"
features:
bot_user:
display_name: MagicButton
always_online: false
oauth_config:
scopes:
bot:
- channels:history
- chat:write
- reactions:read
- users:read.email
- users:read
settings:
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
```
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: '3.8'
services:
app:
build:
context: .
volumes:
- ./.git:/app/.git
environment:
SLACK_BOT_TOKEN:
SLACK_APP_TOKEN:
BUILD_JOB_NAME:
BUILD_JOB_URL:
CURRENT_GIT_COMMIT:
REPOSITORY_NAME:
REPOSITORY_URL:
BRANCHES_TO_PROMOTE:
TIMEOUT_MINUTES:
TIMEZONE:
PRODUCTION_BRANCH:
SLACK_CHANNEL_NAME:
14 changes: 14 additions & 0 deletions test_compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

export BUILD_JOB_NAME=local-test
export BUILD_JOB_URL=http://whatever.com
export CURRENT_GIT_COMMIT=$(git rev-parse HEAD)
export REPOSITORY_NAME=$(basename $(git rev-parse --show-toplevel))
export REPOSITORY_URL=https://github.com/fivexl/magic-button
export BRANCHES_TO_PROMOTE=test
export TIMEOUT_MINUTES=10
export TIMEZONE=$(cat /etc/timezone)
export PRODUCTION_BRANCH=release
export SLACK_CHANNEL_NAME=magic-button-test

docker-compose up -d --build

0 comments on commit 23230a7

Please sign in to comment.