Skip to content

Commit 69f7929

Browse files
committed
feat: CD/CI docker build
1 parent c66ac33 commit 69f7929

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Deploy docker image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
publish-docker-image:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Login to GitHub Container Registry
14+
uses: docker/login-action@v1
15+
with:
16+
registry: ghcr.io
17+
username: ${{ github.actor }}
18+
password: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Build the Docker image
20+
run: |
21+
docker build . --tag ghcr.io/surftimer/surftimer-discord-bot:latest
22+
docker push ghcr.io/surftimer/surftimer-discord-bot:latest

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ RUN git clone https://github.com/Sarrus1/SurfTimer-Discord-Bot.git .
1111

1212
RUN npm i && npm run build
1313

14-
CMD npm run start
14+
CMD ["npm", "run", "start"]

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@ It uses the [discord.js](https://discord.js.org/#/) library and the [prisma ORM]
3232

3333
## How to use it
3434

35-
### Using Docker (recommended)
35+
### Using Docker (Easy and Recommended)
3636

3737
1. Install [Docker](https://docs.docker.com/engine/install/ubuntu/).
3838
2. Create a directory called `SurfTimer-Bot` --- `mkdir SurfTimer-Bot`
39-
3. In this directory, create a file named `Dockerfile` --- `nano SurfTimer-Bot/Dockerfile`.
40-
4. In this file, paste the contents of [this file](https://raw.githubusercontent.com/Sarrus1/SurfTimer-Discord-Bot/main/Dockerfile).
41-
5. In the same directory, create a file named `.env` --- `nano SurfTimer-Bot/.env`
42-
6. In this file, paste the contents of [this file](https://raw.githubusercontent.com/Sarrus1/SurfTimer-Discord-Bot/main/env_sample.txt).
43-
7. Edit the environment variables accordingly (follow the URL for a detailed guide).
44-
8. Run the following command to build the Docker image: `docker build SurfTimer-Bot/ -t surftimer-bot`
45-
9. Now run the container with the following command: `docker run -d --env-file=SurfTimer-Bot/.env surftimer-bot`
39+
3. In this directory, create a file named `docker-compose.yml` --- `nano docker-compose.yml`.
40+
4. In this `docker-compose.yml`, copy/paste the contents of [this file](https://raw.githubusercontent.com/surftimer/SurfTimer-Discord-Bot/main/docker-compose.yml).
41+
5. In this `docker-compose.yml`, edit the environment variables accordingly (follow the URL for a detailed guide).
42+
6. Now run the container with `docker compose up -d`.
4643

4744
### Using Node.js
4845

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.8'
22

33
services:
44
surftimer-bot:
5-
build: ./
5+
image: ghcr.io/surftimer/surftimer-discord-bot:latest
66
restart: always
77
environment:
88
# Discord token (https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot)

0 commit comments

Comments
 (0)