Skip to content

Commit

Permalink
Merge pull request #8 from prise6/dev
Browse files Browse the repository at this point in the history
Prepare v0.1.1
  • Loading branch information
prise6 authored May 6, 2020
2 parents 3a11d5d + 0ac35ae commit 63b4a48
Show file tree
Hide file tree
Showing 15 changed files with 1,129 additions and 99 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/deploy_docker.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: Docker image

on:
pull_request:
types: [closed]
branches:
- master
release:
types: [published]
push:
branches:
- dev-docker

env:
IMAGE_NAME: prise6/mediastrends

jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
Expand Down Expand Up @@ -52,13 +53,32 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: prise6/medias-trends/mediastrends-core
tag_with_sha: True
tag_with_ref: True
- name: Build docker image
uses: zmingxie/docker_buildx@master
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
publish: True
imageName: mediastrends
tag: latest
dockerHubUser: ${{ secrets.DOCKER_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
version: latest
- name: Login dockerhub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build docker image with buildx
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo $IMAGE_NAME:$VERSION
docker buildx build \
--platform linux/amd64,linux/arm/v7 \
--push \
--tag $IMAGE_NAME:$VERSION \
--file Dockerfile .
- name: Clear
run: |
rm -f ${HOME}/.docker/config.json
24 changes: 19 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ ARG PUID=1001
ARG PGID=1001
ARG WORKDIR=/app
ARG VERSION=0.1.1
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

RUN echo "Image target platform details :: "
RUN echo "TARGETOS: $TARGETOS"
RUN echo "TARGETARCH: $TARGETARCH"
RUN echo "TARGETVARIANT: $TARGETVARIANT"

WORKDIR $WORKDIR
ENV WORKDIR=$WORKDIR
ENV MEDIASTRENDS_DIRCONF=$WORKDIR

ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

Expand All @@ -23,6 +27,16 @@ RUN chmod +x ./wait-for-it.sh

COPY ./dist/mediastrends-$VERSION-py3-none-any.whl .

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install --no-install-recommends --yes \
python3-pandas \
python3-scipy python3-sklearn python3-sqlalchemy \
python3-lxml python3-multidict python3-yarl \
tini=0.18.0-1 && \
rm -rf /var/lib/apt/lists/*

ENV PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages

RUN pip install --upgrade pip && \
pip install mediastrends-$VERSION-py3-none-any.whl && \
pip install git+git://github.com/platelminto/parse-torrent-name.git@d3dbf4c7dcc30990b10e88e93596ca1e8afa2c8b#egg=parse-torrent-name && \
Expand All @@ -37,6 +51,6 @@ RUN mkdir -p $WORKDIR/scripts $WORKDIR/logs
COPY scripts/add_movie_torrents.py scripts/stats_movie_torrents.py scripts/
COPY Makefile .

ENTRYPOINT ["/tini", "--", "/entrypoint.sh"]
ENTRYPOINT ["tini", "--", "/entrypoint.sh"]

CMD ["get_movie_trends"]
Loading

0 comments on commit 63b4a48

Please sign in to comment.