Fix debug build
This commit is contained in:
parent
405e0934c2
commit
f43c94c626
3 changed files with 14 additions and 12 deletions
16
README.md
16
README.md
|
@ -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
|
Edit the file [communistquotes/marxistquotes.csv](communistquotes/marxistquotes.csv) and
|
||||||
make an MR.
|
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:
|
execute the following commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd communistquotes/templates/
|
$ cd communistquotes/
|
||||||
sudo docker build . -t communistquotes
|
$ sudo docker build . -f src/Dockerfile -t communistquotes
|
||||||
sudo docker run -it --rm --name communistquotes --env-file ../env communistquotes --debug
|
$ sudo docker run -it --rm --name communistquotes communistquotes --debug
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploy
|
## 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
|
||||||
```
|
```
|
|
@ -20,8 +20,7 @@
|
||||||
- name: copy all build files recursively
|
- name: copy all build files recursively
|
||||||
copy: src={{ item.from }} dest={{ item.to }}
|
copy: src={{ item.from }} dest={{ item.to }}
|
||||||
with_items:
|
with_items:
|
||||||
# folder structure on the target server is intentionally different
|
- { from: 'src/', to: '/tmp/communistquotes/src' }
|
||||||
- { from: 'src/', to: '/tmp/communistquotes' }
|
|
||||||
- { from: 'quotes/', to: '/tmp/communistquotes/quotes' }
|
- { from: 'quotes/', to: '/tmp/communistquotes/quotes' }
|
||||||
|
|
||||||
- name: Build image using cache source
|
- name: Build image using cache source
|
||||||
|
|
|
@ -2,9 +2,10 @@ FROM python:3-alpine
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY requirements.txt ./
|
COPY src/requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r 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" ]
|
||||||
|
|
Loading…
Reference in a new issue