Skip to content

Commit

Permalink
update dockerfile and build.yaml (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
staugur authored Dec 30, 2021
1 parent 08385f6 commit 642a595
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 26 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,6 @@ dmypy.json
# Pyre type checker
.pyre/

proxypool/.env
proxypool/.env
.DS_Store
.vscode
49 changes: 35 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,43 @@ name: build
on:
push:
branches:
- master
- master
paths-ignore:
- .gitignore
- README.md
- '.github/ISSUE_TEMPLATE/**'
- .gitignore
- README.md
- '.github/ISSUE_TEMPLATE/**'
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v1
- name: Docker Login
run: docker login -u germey -p ${{ secrets.DOCKERHUB_LOGIN_PASSWORD }}
- name: Build the Docker Image
run: docker-compose -f build.yaml build
- name: Tag and Push Master Version
run: |
docker push germey/proxypool:master
- name: Checkout
uses: actions/checkout@v2

- 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: germey
password: ${{ secrets.DOCKERHUB_LOGIN_PASSWORD }}

- name: Extract branch name
id: branch
shell: bash
run: echo "##[set-output name=tag;]$(echo ${GITHUB_REF##*/} | sed 's/master/latest/')"

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64
tags: |
germey/proxypool:${{ steps.branch.outputs.tag }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*.db
venv
/.idea
*.log
*.log
.DS_Store
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
FROM alpine:3.7
WORKDIR /app
RUN apk add --no-cache --virtual .build-deps g++ python3-dev libffi-dev \
openssl-dev libxml2-dev libxslt-dev gcc musl-dev py3-pip && \
apk add --no-cache --update python3 && \
pip3 install --upgrade pip setuptools
FROM python:3.7-alpine AS build
COPY requirements.txt .
RUN pip3 install -r requirements.txt && \
apk del g++ gcc musl-dev libxml2-dev
RUN apk update &&\
apk add --no-cache gcc g++ libffi-dev openssl-dev libxml2-dev libxslt-dev &&\
pip install --timeout 30 --user --no-cache-dir --no-warn-script-location -r requirements.txt

FROM python:3.7-alpine
ENV APP_ENV=prod
ENV LOCAL_PKG="/root/.local"
COPY --from=build ${LOCAL_PKG} ${LOCAL_PKG}
RUN apk update && apk add --no-cache libffi-dev openssl-dev libxslt-dev &&\
ln -sf ${LOCAL_PKG}/bin/* /usr/local/bin/
WORKDIR /app
COPY . .
# RUN pip install -r requirements.txt -i https://pypi.douban.com/simple
EXPOSE 5555
VOLUME ["/app/proxypool/crawlers/private"]
CMD ["supervisord", "-c", "supervisord.conf"]
ENTRYPOINT ["supervisord", "-c", "supervisord.conf"]
11 changes: 11 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
[unix_http_server]
file=/run/supervisor.sock
chmod=0700

[supervisord]
pidfile=/run/supervisord.pid
nodaemon=true

[supervisorctl]
serverurl=unix:///run/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[program:tester]
process_name=tester
command=python3 run.py --processor tester
Expand Down

0 comments on commit 642a595

Please sign in to comment.