Skip to content

Commit

Permalink
Merge pull request #4 from Polymathian/add-sharpei-to-docker
Browse files Browse the repository at this point in the history
Add Sharpei to Docker Hub
  • Loading branch information
gricey432 authored Mar 22, 2022
2 parents d78e5df + e9fee14 commit 41f2f23
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/push-to-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Push to Docker

on:
release:
types: [published]

jobs:
docker-push:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
VERSION: ${{github.event.release.tag_name}}

steps:
- name: Set version string
id: vars
run: echo ::set-output name=release_version::${VERSION##*v}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Docker Build and Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386
push: true
tags: |
polymathian/sharpei:latest
polymathian/sharpei:${{ steps.vars.outputs.release_version }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.9-slim-buster

COPY . /app
WORKDIR /app

RUN mkdir /data
RUN pip3 install -e .

ENTRYPOINT [ "sharpei", "/data"]
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,46 @@ Requires Python 3.6+

## Usage

Sharpei can be run from the CLI or Docker.

#### CLI

Install from [PyPI](https://pypi.org/project/sharpei/)

```bash
pip install sharpei
```

#### CLI
To run:

```bash
# Monitor the current directory and send all files
> sharpei . s3://bucket/key-prefix/
```

Use `sharpei --help` to discover additional options

#### Docker

You will need to mount a directory to the Docker image as `/data`.

```bash
> docker run --mount type=bind,source=YOUR_DIRECTORY,target=/data sharpei s3://bucket/key-prefix
```

For example, given a folder structure:

```
working-dir
│ README.md
|
└───target-folder
file011.txt
file012.txt
```

To monitor file changes in `target-folder`, run:

```bash
> docker run --mount type=bind,source="$(pwd)"/target-folder,target=/data polymathian/sharpei s3://my-bucket/my-prefix
```

0 comments on commit 41f2f23

Please sign in to comment.