Fix debug build

This commit is contained in:
Felix Ableitner 2019-11-10 17:18:53 +01:00
parent 405e0934c2
commit f43c94c626
3 changed files with 14 additions and 12 deletions

View file

@ -9,20 +9,22 @@ You can check it out here: https://impenetrable.fortress.promo/communistquotes
Edit the file [communistquotes/marxistquotes.csv](communistquotes/marxistquotes.csv) and
make an MR.
## Compile and Run
## Compile and Debug
First, copy `env.example` to `env`, then enter your actual login information. To run the bot,
To run the bot,
execute the following commands:
```bash
cd communistquotes/templates/
sudo docker build . -t communistquotes
sudo docker run -it --rm --name communistquotes --env-file ../env communistquotes --debug
$ cd communistquotes/
$ sudo docker build . -f src/Dockerfile -t communistquotes
$ sudo docker run -it --rm --name communistquotes communistquotes --debug
```
## Deploy
Copy `inventory.example` to `inventory`, and enter your server's ssh address. Then run the following command:
You need a Mastodon/Pleroma account where the bot will post, and ssh access to a server where the Python bot will run. This can both running on the same server, or they can be seperate.
First, copy `env.example` to `env`, then enter the login information for your Mastodon/Pleroma bot account. Copy `inventory.example` to `inventory`, and enter your server's ssh address. Then run the following command:
```
ansible-playbook ansible.yml --become
$ ansible-playbook ansible.yml --become
```

View file

@ -20,8 +20,7 @@
- name: copy all build files recursively
copy: src={{ item.from }} dest={{ item.to }}
with_items:
# folder structure on the target server is intentionally different
- { from: 'src/', to: '/tmp/communistquotes' }
- { from: 'src/', to: '/tmp/communistquotes/src' }
- { from: 'quotes/', to: '/tmp/communistquotes/quotes' }
- name: Build image using cache source

View file

@ -2,9 +2,10 @@ FROM python:3-alpine
WORKDIR /usr/src/app
COPY requirements.txt ./
COPY src/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
COPY src/*.py src/
COPY quotes/ quotes/
ENTRYPOINT [ "python", "./main.py" ]
ENTRYPOINT [ "python", "./src/main.py" ]