Skip to content
This repository has been archived by the owner on Nov 19, 2017. It is now read-only.

Commit

Permalink
Alpine (#70)
Browse files Browse the repository at this point in the history
* ShellChecke

http://www.shellcheck.net/

* Add vs code to gitignore

* Add dockerignore

* Migrate to Alpine

* Update readme

- Changed the "Run it yourself" instructions so the user does not have to clone the Git repo.
- Added Contributing
- Added Credits

* Missing backslash
  • Loading branch information
TBK authored and iCrawl committed May 19, 2017
1 parent f647c46 commit 56452bd
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 33 deletions.
32 changes: 32 additions & 0 deletions .dockerignore
@@ -0,0 +1,32 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# IDE
.vscode

# Git
.github
.git
.gitattributes
.gitignore

# Deployment
deploy
.travis.yml

# Dependency directory
node_modules

# Docker
.dockerignore
docker-compose.yml
docker-compose.yml.example
docker.sh
Dockerfile
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -8,6 +8,9 @@ pids
*.pid
*.seed

# IDE
.vscode

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

Expand Down
30 changes: 17 additions & 13 deletions Dockerfile
@@ -1,20 +1,24 @@
FROM ubuntu:zesty
FROM node:7-alpine

RUN apt update
RUN apt upgrade -y
RUN apt install -y curl
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
RUN apt update
RUN apt install -y build-essential ffmpeg git python nodejs
RUN apt install -y libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev g++
RUN apt autoremove -y
LABEL maintainer "iCrawl <icrawltogo@gmail.com>"

RUN mkdir -p /usr/src/Commando
# Add package.json for Yarn
WORKDIR /usr/src/Commando
COPY package.json yarn.lock ./

COPY . .
# Install dependencies
RUN apk add --update \
&& apk add --no-cache ffmpeg opus pixman cairo pango giflib ca-certificates \
&& apk add --no-cache --virtual .build-deps git curl pixman-dev cairo-dev pangomm-dev libjpeg-turbo-dev giflib-dev python g++ make \
\
# Install node.js dependencies
&& yarn install \
\
# Clean up build dependencies
&& apk del .build-deps

RUN npm install
# Add project source
COPY . .

ENV TOKEN= \
COMMAND_PREFIX= \
Expand All @@ -34,4 +38,4 @@ ENV TOKEN= \
MAX_SONGS= \
PASSES=

CMD node Commando.js
CMD ["node", "Commando.js"]
28 changes: 23 additions & 5 deletions README.md
@@ -1,4 +1,16 @@
# Commando
> Commando Discord bot built on discord.js-commando.
## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D


## Run it yourself

## Installation guide for Ubuntu 16.04.2 LTS

Expand All @@ -17,16 +29,22 @@ sudo apt-get install -y docker-engine
sudo pip install docker-compose
```

#### Clone settings
#### Get ready
```bash
cp docker-compose.yml.example docker-compose.yml
wget https://raw.githubusercontent.com/WeebDev/Commando/master/docker-compose.yml.example -O docker-compose.yml
```

Fill out all the needed ENV variables.
***Fill out all the needed ENV variables.***

#### Launch docker-compose
Make sure docker.sh is executeable.

```bash
docker.sh
docker-compose up -d
```

## Author

**Commando** © [WeebDev](https://github.com/WeebDev), Released under the [MIT](https://github.com/WeebDev/Commando/blob/master/LICENSE) License.<br>
Authored and maintained by WeebDev.

> GitHub [@WeebDev](https://github.com/WeebDev)
12 changes: 6 additions & 6 deletions deploy/deploy.sh
Expand Up @@ -6,7 +6,7 @@ function test {
npm test
}

if [ "$TRAVIS_BRANCH" == revert-* ]; then
if [[ "$TRAVIS_BRANCH" == revert-* ]]; then
echo -e "\e[36m\e[1mBuild triggered for reversion branch \"${TRAVIS_BRANCH}\" - running nothing."
exit 0
fi
Expand All @@ -19,18 +19,18 @@ fi

if [ -n "$TRAVIS_TAG" ]; then
echo -e "\e[36m\e[1mBuild triggered for tag \"${TRAVIS_TAG}\"."
DOCKER_RELEASE=$TRAVIS_TAG
DOCKER_RELEASE="$TRAVIS_TAG"
test
docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD"
docker build -t commando .
docker tag commando:latest crawl/commando:$DOCKER_RELEASE
docker push crawl/commando:$DOCKER_RELEASE
docker tag commando:latest crawl/commando:"$DOCKER_RELEASE"
docker push crawl/commando:"$DOCKER_RELEASE"
else
echo -e "\e[36m\e[1mBuild triggered for branch \"${TRAVIS_BRANCH}\"."
DOCKER_RELEASE="latest"
test
docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD"
docker build -t commando .
docker tag commando:latest crawl/commando:$DOCKER_RELEASE
docker push crawl/commando:$DOCKER_RELEASE
docker tag commando:latest crawl/commando:"$DOCKER_RELEASE"
docker push crawl/commando:"$DOCKER_RELEASE"
fi
19 changes: 10 additions & 9 deletions docker-compose.yml.example
Expand Up @@ -3,13 +3,12 @@ services:
commando:
image: "crawl/commando:latest"
restart: always
container_name: commando
environment:
- TOKEN=BOT_TOKEN
- COMMAND_PREFIX=-
- OWNERS=OWNER_IDS,CAN,BE,SEPERATED,BY,COMMAS
- DB=postgres://POSTGRES_USER_DEFINED_IN_POSTGRES_ENV:POSTGRES_PW_DEFINED_IN_POSTGRES_ENV@postgres:5432/POSTGRES_DB_EITHER_USER_DEFINED_IN_POSTGRES_ENV_OR_POSTGRES_DB_DEFINED_IN_POSTGRES
- REDIS=REDIS_HOSTNAME
- REDIS=redis
- EXAMPLE_CHANNEL=CHANNEL_TO_POST_EXAMPLES_IN
- WEATHER_API=DARK_SKY_WEATHER_API_KEY
- GOOGLE_API=GOOGLE_API_KEY_FOR_YOUTUBE_AND_GEOCODE
Expand All @@ -22,17 +21,19 @@ services:
- MAX_LENGTH=MAXIMUM_LENGTH_PER_SONG
- MAX_SONGS=HOW_MANY_SONGS_A_USER_CAN_QUEUE_UP
- PASSES=UPD_PACKET_PASS
depends_on:
- postgres
- redis

postgres:
image: "postgres:9"
container_name: commando_db
image: "postgres:9-alpine"
environment:
- POSTGRES_USER=commando
- POSTGRES_PASSWORD=POSTGRES_PW
- PGDATA=PATH_TO_DIRECTORY_THAT_SAVES_DATA_ON_THE_SYSTEM
volumes:
- LOCALHOST_VOLUME_PATH:PATH_DEFINED_IN_PGDATA
- LOCALHOST_VOLUME_PATH/postgresql/data:/var/lib/postgresql/data

redis:
image: "redis:3"
container_name: commando_redis
image: "redis:3-alpine"
volumes:
- LOCALHOST_VOLUME_PATH:/data
- LOCALHOST_VOLUME_PATH/redis/data:/data

0 comments on commit 56452bd

Please sign in to comment.