Skip to content

Commit

Permalink
build test
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslayerrq committed Dec 18, 2023
1 parent 4683c18 commit 6e2ff76
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 8 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy to DigitalOcean

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
deploy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}



- name: CICD
uses: appleboy/[email protected]
with:
host: ${{secrets.SSH_HOST_RQ}}
key: ${{secrets.SSH_KEY_RQ}}
username: ${{secrets.SSH_USERNAME_RQ}}

script: |
if [ ! -d "rice_trader" ]; then
mkdir rice_trader
fi
cd rice_trader/
docker container prune -f
docker image prune -f
docker volume prune -f
docker-compose pull
docker-compose down
docker-compose up -d
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pytest = "*"
pytest-cov = "*"
coverage = "*"
mongomock = "*"
pytest--cov = "*"

[dev-packages]

Expand Down
2 changes: 1 addition & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.11"

services:
mongodb:
image: mongo:latest
container_name: mongo2
ports:
- "27017:27017"

frontend:
build: ./web-app # build the Docker image from the Dockerfile in the front-end directory
image: kingslayerrq/rice:v1
container_name: traderwebappcontainer
ports:
- "3000:3000"
depends_on:
- mongodb





volumes:
mongodb-data:
8 changes: 3 additions & 5 deletions web-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ WORKDIR /web-app

COPY requirements.txt ./

RUN apt-get update && apt-get install -y ffmpeg
RUN apt-get -y install libasound-dev
RUN apt-get -y install portaudio19-dev

RUN pip install --no-cache-dir -r requirements.txt

COPY . /web-app

EXPOSE 5000
EXPOSE 3000


# Run app.py when the container launches

COPY . /app

EXPOSE 5000
EXPOSE 3000

CMD ["python", "app.py"]
4 changes: 2 additions & 2 deletions web-app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
app = Flask('Trader')
app.secret_key = 'pass'

client = MongoClient("mongodb://localhost:27017/")
client = MongoClient("mongodb://mongo2:27017/")
db = client["trade_database"]

@app.route('/Trade')
Expand Down Expand Up @@ -296,4 +296,4 @@ def UserProfile():


if __name__ == "__main__":
app.run(host="0.0.0.0", port=int(os.getenv("PORT", "5000")), debug=True)
app.run(host="0.0.0.0", port=int(os.getenv("PORT", "3000")), debug=True)

0 comments on commit 6e2ff76

Please sign in to comment.