-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Dockerfile and GH Action to publish at Dockerhub and GHCR
- Loading branch information
Showing
3 changed files
with
92 additions
and
1 deletion.
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,42 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
workflow_dispatch: # run manually | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- name: Replace underscores in tag name | ||
run: NAME="$GITHUB.REPOSITORY"; echo DOCKER_TAG=${NAME//_//} >> $GITHUB_ENV | ||
- uses: actions/checkout@v3 | ||
- # Activate cache export feature to reduce build time of image | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build the Docker image | ||
run: make docker DOCKER_TAG=${{ env.DOCKER_TAG }} | ||
- name: Login to Dockerhub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: Push image to Dockerhub | ||
run: docker push ${{ env.DOCKER_TAG }} | ||
- name: Alias the Docker image for GHCR | ||
run: docker tag ${{ env.DOCKER_TAG }} ghcr.io/${{ env.DOCKER_TAG }} | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push image to Github Container Registry | ||
run: docker push ghcr.io/${{ env.DOCKER_TAG }} |
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,37 @@ | ||
FROM ocrd/core-cuda | ||
ARG VCS_REF | ||
ARG BUILD_DATE | ||
LABEL \ | ||
maintainer="https://ocr-d.de/kontakt" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url="https://github.com/bertsky/detectron2" \ | ||
org.label-schema.build-date=$BUILD_DATE | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV PYTHONIOENCODING utf8 | ||
|
||
# avoid HOME/.local/share (hard to predict USER here) | ||
# so let XDG_DATA_HOME coincide with fixed system location | ||
# (can still be overridden by derived stages or at runtime) | ||
# should be combined with a bind-mount at runtime | ||
ENV XDG_DATA_HOME /usr/local/share | ||
|
||
WORKDIR /build-ocrd | ||
COPY setup.py . | ||
COPY ocrd_detectron2/ocrd-tool.json . | ||
COPY README.md . | ||
COPY requirements.txt . | ||
COPY requirements-test.txt . | ||
COPY ocrd_detectron2 ./ocrd_detectron2 | ||
COPY Makefile . | ||
RUN apt-get install -y --no-install-recommends g++ && \ | ||
make deps && \ | ||
make install && \ | ||
rm -rf /build-ocrd && \ | ||
apt-get -y remove --auto-remove g++ | ||
|
||
WORKDIR /data | ||
VOLUME /data | ||
|
||
# override Nvidia entrypoint | ||
ENTRYPOINT [] |
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