-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from swthewhite/main
new version(v0.2.0) developed
- Loading branch information
Showing
6 changed files
with
246 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Docker Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
env: | ||
DOCKER_IMAGE: ghcr.io/swthewhite/myproject | ||
VERSION: ${{ github.sha }} | ||
NAME: newdevelop | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup docker buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Cache docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ env.VERSION }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to ghcr | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: ${{ env.DOCKER_IMAGE }}:latest | ||
|
||
deploy: | ||
needs: build | ||
name: Deploy | ||
runs-on: [ self-hosted ] | ||
steps: | ||
- name: Login to ghcr | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Docker run | ||
run: | | ||
docker stop ${{ env.NAME }} && docker rm ${{ env.NAME }} && docker rmi ${{ env.DOCKER_IMAGE }}:latest | ||
docker run -d -p 3000:3000 --name ${{ env.NAME }} --restart always ${{ env.DOCKER_IMAGE }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM python:3.11.1 | ||
|
||
WORKDIR /code | ||
|
||
COPY ./requirements.txt /code/requirements.txt | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get install -y tzdata | ||
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime | ||
|
||
RUN apt-get update | ||
RUN apt-get -y install libgl1-mesa-glx wget | ||
RUN pip install --no-cache-dir -r /code/requirements.txt | ||
|
||
COPY . /code | ||
|
||
WORKDIR /code/WebServer/yolo_data | ||
|
||
RUN wget https://pjreddie.com/media/files/yolov3.weights | ||
|
||
WORKDIR /code/WebServer | ||
|
||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.