Skip to content

Commit

Permalink
Merge pull request #3 from TrustWiseAgent/docker
Browse files Browse the repository at this point in the history
add docker file
  • Loading branch information
kenplusplus authored Dec 27, 2024
2 parents 05e55cc + 43aaf7a commit 038c12d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Docker

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
publish_docker_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }}
password: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }}

- name: Build, tag, and push the image to Aliyun registry
id: build-image
env:
ALIYUN_REGISTRY: "registry.cn-hangzhou.aliyuncs.com"
ALIYUN_REPOSITORY: kenplusplus/gentrade_server
IMAGE_TAG: ${{ env.RELEASE_VERSION }}
run: |
docker build --no-cache -t $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG .
docker push $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG
docker tag $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:latest
docker push $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:latest
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:22.04

RUN apt update -y && apt install -y python3 python3-pip git && apt clean -y

ENV PIP_MIRROR="-i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
ENV GENTRADE_CACHE_DIR="/app/cache/"

ADD . /app/GenTradeServer
RUN git clone https://github.com/TrustWiseAgent/GenTrade /app/GenTrade

ENV PYTHONPATH=/app/GenTrade/src/:/app/GenTradeServer/src/

VOLUME [ "/app/cache/" ]
WORKDIR /app/GenTradeServer/src/

RUN pip install ${PIP_MIRROR} -r /app/GenTrade/requirements.txt
RUN pip install ${PIP_MIRROR} -r /app/GenTradeServer/requirements.txt


EXPOSE 8000

ENTRYPOINT [ "uvicorn", "gentrade_server.main:app", \
"--host", "0.0.0.0", \
"--port", "8000" ]

0 comments on commit 038c12d

Please sign in to comment.