Skip to content

Commit 0d780be

Browse files
Add startup script and screen to Docker image
1 parent 4cd59aa commit 0d780be

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/build_push.yml

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
registry: ghcr.io
4242
username: ${{ github.repository_owner }}
4343
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Give X perms to startup.sh
46+
run: |
47+
chmod +x startup.sh
48+
ls -la | grep startup.sh
4449
4550
- name: Build and Push
4651
uses: docker/build-push-action@v2

Dockerfile

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ FROM python:3.8-slim-buster
22

33
WORKDIR /app
44

5-
RUN apt-get update && apt-get install -y procps net-tools
5+
RUN apt-get update && apt-get install -y procps net-tools screen
66

77
COPY requirements.txt requirements.txt
88
RUN pip3 install -r requirements.txt
99

1010
COPY . .
1111

12-
CMD [ "python3", "discord_bot.py" ]
12+
# Run app directly
13+
#CMD [ "python3", "discord_bot.py" ]
14+
15+
# Run app in a screen session via startup script
16+
CMD [ "startup.sh" ]

startup.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
screen -S discordbot -d -m python discord_bot.py

0 commit comments

Comments
 (0)