Skip to content

Commit

Permalink
major overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
OLeonardoRodrigues committed Jul 29, 2022
1 parent 161320b commit 52eebdd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .repo-keeper → .keypr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
topic1
topic2
topic3
topic4
topic5

[options]
default-branch = main
Expand Down
45 changes: 21 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
FROM python:3.9-slim-buster
FROM python:3.9.13-alpine3.16 AS base

LABEL org.opencontainers.image.title="Repo Keeper" \
LABEL org.opencontainers.image.title="Keypr" \
org.opencontainers.image.description="Configuration Keeper for GitHub Repositories." \
org.opencontainers.image.url="https://github.com/OLeonardoRodrigues/repo-keeper/blob/main/README.md" \
org.opencontainers.image.documentation="https://github.com/OLeonardoRodrigues/repo-keeper/wiki" \
org.opencontainers.image.source="https://github.com/OLeonardoRodrigues/repo-keeper" \
org.opencontainers.image.licenses="GPL-3.0-only" \
org.opencontainers.image.vendor="Leonardo Rodrigues de Oliveira - OLeonardoRodrigues" \
org.opencontainers.image.base.name="registry.hub.docker.com/python/python:3.9-slim-buster" \
org.opencontainers.image.base.digest="sha256:a32a3204b2b44f3e7e699e5b4af1a5784b6a9b8a4f4446dbb8a3aa65375a8d7d"
org.opencontainers.image.url="https://github.com/fr-platform/keypr/blob/main/README.md" \
org.opencontainers.image.documentation="https://github.com/fr-platform/keypr/wiki" \
org.opencontainers.image.source="https://github.com/fr-platform/keypr" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.vendor="Fr Platform" \
org.opencontainers.image.base.name="registry.hub.docker.com/python/python:3.9.13-alpine3.16"

WORKDIR /app

ENV PYTHONPATH /app

ENV GH_CONFIG_DIR /app/gh_config

RUN useradd -m python

RUN mkdir /app/gh_config \
&& chown -R python:python /app/gh_config \
&& chmod +w /app/gh_config
RUN addgroup -S python \
&& adduser -S python -G python \
&& apk update \
&& apk add --no-cache --virtual .build-deps curl \
&& apk add --no-cache git github-cli \
&& apk del --purge .build-deps \
&& mkdir --mode=777 /app/gh_config \
&& chown --recursive python:python /app/gh_config

COPY --chown=python:python requirements.txt ./

RUN pip3 install -r requirements.txt
RUN pip install --no-cache-dir --no-color --no-python-version-warning --disable-pip-version-check --requirement requirements.txt \
&& rm -f requirement.txt

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install curl -y \
&& apt-get install git -y \
&& curl -L https://github.com/cli/cli/releases/download/v2.7.0/gh_2.7.0_linux_amd64.deb \
> gh_2.7.0_linux_amd64.deb \
&& dpkg -i ./gh_2.7.0_linux_amd64.deb
FROM base AS deploy

COPY --chown=python:python src repo_keeper
COPY --chown=python:python src keypr

USER python

CMD [ "python3.9", "-m" , "repo_keeper"]
CMD [ "python", "-m" , "keypr"]
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Repo Keeper'
description: 'Runs Repo Keeper'
name: 'Keypr'
description: 'Runs Keypr'
author: 'OLeonardoRodrigues'

branding:
Expand All @@ -14,11 +14,11 @@ inputs:
config-file:
description: 'Configuration File Name or Path.'
required: false
default: '.repo-keeper'
default: '.keypr'

runs:
using: 'docker'
image: 'docker://ghcr.io/oleonardorodrigues/repo-keeper:latest'
image: 'docker://ghcr.io/oleonardorodrigues/keypr:latest'
env:
GH_PAT: ${{ inputs.github-pat }}
CONFIG_FILE: ${{ inputs.config-file }}
11 changes: 11 additions & 0 deletions scripts/docker_run_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

sudo docker rmi --force keypr:local

sudo docker container prune --force

sudo docker build . --tag keypr:local --no-cache --progress plain

sudo docker run --detach --name keypr keypr:local

sudo docker images --all --format '{{.Size}}' keypr:local
2 changes: 1 addition & 1 deletion src/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
def auth():
print('Authenticating to GitHub.')
try:
system(f"echo {environ.get('GH_PAT')} | gh auth login --git-protocol https --hostname GitHub.com --with-token")
system(f"echo {environ.get('GH_PAT')} | gh auth login --git-protocol https --hostname GitHub.com --with-token && gh auth status")
except:
print("Failure authenticating to GitHub.")
2 changes: 1 addition & 1 deletion src/parse_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def parse_config():
try:
filename = path.abspath(environ.get('CONFIG_FILE'))
except:
filename = '.repo-keeper'
filename = '.keypr'
topics = parse_topics(filename=filename)
options = parse_options(filename=filename)

Expand Down

0 comments on commit 52eebdd

Please sign in to comment.