Skip to content

Commit

Permalink
added dockerignore (#38)
Browse files Browse the repository at this point in the history
Refactored Dockerfile to generate a more lightweight image, added a docker-compose file to quickly kick off your application. Also improved security since tokens have to be mounted instead of being built into the image.
  • Loading branch information
coillteoir authored Nov 19, 2023
1 parent 9b1ff1b commit 9fe4e1f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
README.md
CONTRIBUTING.md
**/__pycache__/
.git/
token
12 changes: 12 additions & 0 deletions .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Dev Image Build"
run-name: ${{ github.actor }} Dev Image Build
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "Job triggered by ${{ github.event_name }}."
- uses: actions/checkout@v3
- run: docker --version
- run: docker build -t morningbot-dev .
- run: docker image ls | grep morningbot-dev
6 changes: 3 additions & 3 deletions .github/workflows/json-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Json-Validate
run-name: ${{ github.actor }} PR being linted for code cleanliness
name: Json Validate
run-name: ${{ github.actor }} Validating JSON in config files
on: [pull_request]
jobs:
Lint:
validate:
runs-on: ubuntu-latest
steps:
- run: echo "Job triggered by ${{ github.event_name }} event."
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-lint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Test-Lint
name: Python Lint
run-name: ${{ github.actor }} PR being linted for code cleanliness
on: [pull_request]
jobs:
Lint:
lint:
runs-on: ubuntu-latest
steps:
- run: echo "Job triggered by ${{ github.event_name }} event."
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
FROM python:latest

FROM gorialis/discord.py
FROM python:3.11-slim

RUN mkdir -p /usr/src/MorningBot

WORKDIR /usr/src/MorningBot

COPY . .
RUN pip install -r requirements.txt

CMD ["python3", "main.py"]
CMD ["python3", "."]
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: '3'
services:
morningbot:
image: morningbot:latest
volumes:
- ./token:/usr/src/MorningBot/token

0 comments on commit 9fe4e1f

Please sign in to comment.