Skip to content

Commit

Permalink
Merge pull request #22 from software-students-fall2023/rq-mac
Browse files Browse the repository at this point in the history
build test
  • Loading branch information
KeiOshima authored Dec 18, 2023
2 parents 4683c18 + 6705b14 commit 85f3661
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
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
cd rice_trader
git clone https://github.com/software-students-fall2023/5-final-project-rice.git
cd 5-final-project-rice
else
cd rice_trader/5-final-project-rice
git pull origin main
fi
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 85f3661

Please sign in to comment.