forked from asreview/asreview
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create workflow for building and pushing docker images to GitHub regi…
…stry (asreview#1341) * Build docker images from the project folder directly * Create Docker workflow to automatically push to Docker Hub * Move Docker image to GitHub Container Registry (ghcr.io)
- Loading branch information
1 parent
5b925d0
commit 456369e
Showing
9 changed files
with
158 additions
and
151 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,29 @@ | ||
__pycache__ | ||
asreview.egg-info | ||
build | ||
dist | ||
docker | ||
docs | ||
env | ||
images | ||
tests | ||
|
||
.coveragerc | ||
.dockerignore | ||
.gitattributes | ||
.github | ||
.gitignore | ||
.gitmodules | ||
.readthedocs.yaml | ||
.vscode | ||
.zenodo.json | ||
app.json | ||
asreview/webapp/node_modules | ||
azuredeploy.json | ||
azuredeploy.parameters.json | ||
MANIFEST.in | ||
*.md | ||
|
||
!README.md | ||
|
||
# .git is not ignored because we need the information for versioneer |
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,59 @@ | ||
name: Docker deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build the image for testing | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
load: true | ||
tags: asreview/asreview:test | ||
- name: Test the built image | ||
run: | | ||
docker run asreview/asreview:test -h | ||
- name: Docker meta | ||
id: meta | ||
if: github.event_name != 'pull_request' | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/asreview/asreview | ||
- name: Login to GitHub registry | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and, if it is not a pull request, push to Docker Hub | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,25 @@ | ||
# First stage | ||
FROM python:3.8-slim AS builder | ||
WORKDIR /app | ||
|
||
# Copy and build asreview | ||
# git is used by versioneer to define the project version | ||
COPY . /app | ||
RUN apt-get update \ | ||
&& apt-get install -y git npm \ | ||
&& pip3 install --upgrade pip setuptools \ | ||
&& python3 setup.py compile_assets \ | ||
&& pip3 install --user . \ | ||
&& pip3 install --user asreview-datatools asreview-insights asreview-makita asreview-wordcloud | ||
|
||
# Second stage | ||
FROM python:3.8-slim | ||
|
||
COPY --from=builder /root/.local /root/.local | ||
|
||
ENV ASREVIEW_HOST=0.0.0.0 | ||
ENV PATH=/root/.local/bin:$PATH | ||
ENV ASREVIEW_PATH=project_folder | ||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["asreview"] |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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