Skip to content

Commit

Permalink
docker: Add support for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
darktohka committed Sep 17, 2020
1 parent d6184c6 commit e084998
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 15 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.git
.github

Dockerfile
cache.json
settings.json
run.sh

logs
supplementary
tmp

README.md
25 changes: 25 additions & 0 deletions .github/workflows/autobuild-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Autobuild for Docker

on:
push:
branches: master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install builder plugin
id: buildx
uses: crazy-max/ghaction-docker-buildx@v3
with:
buildx-version: latest
qemu-version: latest
- name: Login to Docker
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build the image
run: |
docker buildx build --push \
--tag "${{secrets.DOCKER_TAG}}" \
--platform linux/amd64,linux/arm/v7 .
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:rc-alpine

ENV SHELL /bin/sh
ENV LANG C.UTF-8

ENV PYTHONUNBUFFERED 1
ENV PIP_DISABLE_PIP_VERSION_CHECK 1
ENV PIP_NO_CACHE_DIR 0

COPY . /srv
WORKDIR /srv

RUN \
# Create user
addgroup -g 423 -S pkgcollector \
&& adduser -u 423 -S pkgcollector -G pkgcollector \
# Upgrade system
&& apk update \
&& apk upgrade --no-cache \
&& apk add --no-cache dpkg gnupg gzip fakeroot xz tar \
# Install Python dependencies
&& pip install --no-cache --upgrade -r requirements.txt \
&& chown -R pkgcollector:pkgcollector . \
# Cleanup
&& rm -rf /tmp/* /var/cache/apk/*

USER pkgcollector
ENTRYPOINT ["python", "-m", "pkgcollector.Main"]
14 changes: 0 additions & 14 deletions pkgcollector/Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,5 @@ def saveSettings(self):
json.dump(self.settings, file, sort_keys=True, indent=4, separators=(',', ': '))

if __name__ == '__main__':
def get_lock(process_name):
get_lock._lock_socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)

try:
get_lock._lock_socket.bind('\0' + process_name)
except socket.error:
print('Program is already running!')
sys.exit()

if os.geteuid() != 0:
print('Please run this program as root!')
sys.exit()

get_lock('PackageCollector')
main = Main()
main.runAllBuilds()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bs4
beautifulsoup4
deb-pkg-tools
python-gnupg
requests

0 comments on commit e084998

Please sign in to comment.