Skip to content

Commit

Permalink
Merge pull request #9 from syx0310/master
Browse files Browse the repository at this point in the history
Use github action to build docker image
  • Loading branch information
tza17313 authored Apr 26, 2024
2 parents c65e969 + 46595c9 commit b8c155a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and Push Docker image

on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/[email protected]

- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ vars.DOCKER_USERNAME }}/${{ vars.IMAGE_NAME }}:latest
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM python:3.8.10-buster
USER root

COPY ./sources.list /etc/apt/sources.list
# COPY ./sources.list /etc/apt/sources.list
RUN apt update && \
apt install -y libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libfontconfig1 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/log/*
Expand All @@ -10,11 +10,11 @@ WORKDIR /app
COPY requirements.txt .

# 安装依赖包
RUN pip3 install --no-cache-dir -r requirements.txt --index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
RUN pip3 install --no-cache-dir -r requirements.txt


COPY ./weights/retinaface.h5 /models/.deepface/weights/retinaface.h5
COPY ./weights/facenet512_weights.h5 /models/.deepface/weights/facenet512_weights.h5
RUN mkdir -p /models/.deepface/weights && \
wget -nv -O /models/.deepface/weights/retinaface.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/retinaface.h5 && \
wget -nv -O /models/.deepface/weights/facenet512_weights.h5 https://github.com/serengil/deepface_models/releases/download/v1.0/facenet512_weights.h5


COPY server.py .
Expand Down

0 comments on commit b8c155a

Please sign in to comment.