Skip to content

Commit b955a0b

Browse files
committed
Added ci workflow
1 parent 0fa0426 commit b955a0b

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

.github/workflows/docker-build.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'server/**'
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v2
20+
21+
- name: Check commit message
22+
id: check_commit
23+
run: |
24+
if ! git log -1 --pretty=%B | grep -q "docker build:"; then
25+
echo "Commit message does not contain 'docker build:', skipping Docker build."
26+
exit 0
27+
fi
28+
29+
- name: Log in to DockerHub
30+
uses: docker/login-action@v2
31+
with:
32+
username: ${{ secrets.DOCKER_USERNAME }}
33+
password: ${{ secrets.DOCKER_PASSWORD }}
34+
35+
- name: Build Docker image
36+
run: |
37+
docker build -t devhub-server ./server
38+
39+
- name: Push Docker image to DockerHub
40+
run: |
41+
docker tag devhub-server:latest ${{ secrets.DOCKER_USERNAME }}/devhub-server:latest
42+
docker push ${{ secrets.DOCKER_USERNAME }}/devhub-server:latest

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2024] [Deepraj Bera]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

server/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:3.9-slim
2+
3+
WORKDIR /server
4+
5+
COPY requirements.txt .
6+
7+
RUN pip install --no-cache-dir -r requirements.txt
8+
9+
COPY . .
10+
11+
EXPOSE 5000
12+
13+
CMD ["flask", "run"]

server/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from app import create_app
2-
import gunicorn
32

43
app = create_app()
54

0 commit comments

Comments
 (0)