Skip to content

Commit 2c92664

Browse files
committed
Created CI pipeline
1 parent 0715a00 commit 2c92664

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build_and_push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v2
18+
19+
- name: Docker Login
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GHCR_TOKEN }}
25+
26+
- name: Setup node
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: 22
30+
31+
- name: NPM Setup
32+
run: npm i
33+
34+
- name: Build project
35+
run: npx npm run build
36+
37+
- name: Build & Push Image
38+
uses: docker/build-push-action@v4
39+
with:
40+
context: ${{ github.workspace }}
41+
push: true
42+
platforms: linux/arm64,linux/amd64
43+
tags: ghcr.io/tutorialwork/my-channel/server:${{ github.ref_name }}

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ ADD . /usr/src/app
1313

1414
RUN npm run build
1515

16+
COPY init-entrypoint.sh /init-entrypoint.sh
17+
18+
ENTRYPOINT ["/init-entrypoint.sh"]
19+
1620
CMD [ "npm", "run", "start" ]
1721

1822
EXPOSE 3000

init-entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
export MYSQL_PASSWORD="$(cat /run/secrets/MY_CHANNEL_MYSQL_PASSWORD)"
4+
export API_KEY="$(cat /run/secrets/MY_CHANNEL_API_KEY)"
5+
export MJ_APIKEY_PUBLIC="$(cat /run/secrets/MY_CHANNEL_MJ_APIKEY_PUBLIC)"
6+
export MJ_APIKEY_PRIVATE="$(cat /run/secrets/MY_CHANNEL_MJ_APIKEY_PRIVATE)"
7+
8+
exec "$@"

0 commit comments

Comments
 (0)