Skip to content

Commit

Permalink
Add Dockerfile and GitHub action to build and push to docker hub
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner committed Dec 28, 2022
1 parent 50f3e7a commit 4025cd1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: docker

on:
push:
branches:
- "master"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sort-google-scholar:latest
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10-slim

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN python -m pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ './sortgs.py' ]
27 changes: 27 additions & 0 deletions docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: docker

on:
push:
branches:
- "master"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sort-google-scholar:latest

0 comments on commit 4025cd1

Please sign in to comment.