mirror of https://github.com/rq/rq.git
Docker (#1471)
* rqtest -> tests folder * worker Dockerfile to repo folder * Dockerfile: install rq from file next to it * add docker workflow
This commit is contained in:
parent
28e7ab10df
commit
d0cea42fbb
|
@ -0,0 +1,51 @@
|
|||
name: Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
tags: [ '*' ]
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
push:
|
||||
if: github.repository == 'rq/rq'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Push
|
||||
run: |
|
||||
# Parse Version
|
||||
# "master" -> "master"
|
||||
# "v1.2.3" -> "1.2.3", "1.2", "1", "latest"
|
||||
|
||||
VERSIONS=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && {
|
||||
VERSIONS=$(echo $VERSIONS | sed -e 's/^v//')
|
||||
i="$VERSIONS"
|
||||
while [[ "$i" == *"."* ]]
|
||||
do i="$(echo "$i" | sed 's/\(.*\)\..*/\1/g')"
|
||||
VERSIONS="$VERSIONS $i"
|
||||
done
|
||||
VERSIONS="$VERSIONS latest"
|
||||
}
|
||||
|
||||
echo Building with tags: $VERSIONS
|
||||
|
||||
# Login to registries
|
||||
echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
|
||||
echo "${{ secrets.DOCKER_TOKEN }}" | docker login -u TODO --password-stdin
|
||||
|
||||
# Build image
|
||||
docker build . --tag worker
|
||||
|
||||
# Tag and Push
|
||||
for VERSION in $VERSIONS
|
||||
do docker tag worker redisqueue/worker:$VERSION
|
||||
docker push redisqueue/worker:$VERSION
|
||||
docker tag worker docker.pkg.github.com/rq/rq/worker:$VERSION
|
||||
docker push docker.pkg.github.com/rq/rq/worker:$VERSION
|
||||
done
|
22
Dockerfile
22
Dockerfile
|
@ -1,19 +1,11 @@
|
|||
FROM ubuntu:latest
|
||||
FROM python:3.8
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
redis-server \
|
||||
python3-pip \
|
||||
stunnel
|
||||
|
||||
COPY tests/ssl_config/private.pem tests/ssl_config/stunnel.conf /etc/stunnel/
|
||||
WORKDIR /root
|
||||
|
||||
COPY . /tmp/rq
|
||||
WORKDIR /tmp/rq
|
||||
RUN pip3 install -r /tmp/rq/requirements.txt -r /tmp/rq/dev-requirements.txt \
|
||||
&& python3 /tmp/rq/setup.py build \
|
||||
&& python3 /tmp/rq/setup.py install
|
||||
|
||||
CMD stunnel \
|
||||
& redis-server \
|
||||
& RUN_SLOW_TESTS_TOO=1 RUN_SSL_TESTS=1 pytest /tmp/rq/tests/ --durations=5 -v --log-cli-level 10
|
||||
RUN pip install /tmp/rq
|
||||
|
||||
RUN rm -r /tmp/rq
|
||||
|
||||
ENTRYPOINT ["rq", "worker"]
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
FROM python:3.8
|
||||
|
||||
RUN pip install rq
|
||||
|
||||
ENTRYPOINT ["rq", "worker"]
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker build . -t rqtest && docker run -it --rm rqtest
|
||||
docker build -f tests/Dockerfile . -t rqtest && docker run -it --rm rqtest
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
FROM ubuntu:latest
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
redis-server \
|
||||
python3-pip \
|
||||
stunnel
|
||||
|
||||
COPY tests/ssl_config/private.pem tests/ssl_config/stunnel.conf /etc/stunnel/
|
||||
|
||||
COPY . /tmp/rq
|
||||
WORKDIR /tmp/rq
|
||||
RUN pip3 install -r /tmp/rq/requirements.txt -r /tmp/rq/dev-requirements.txt \
|
||||
&& python3 /tmp/rq/setup.py build \
|
||||
&& python3 /tmp/rq/setup.py install
|
||||
|
||||
CMD stunnel \
|
||||
& redis-server \
|
||||
& RUN_SLOW_TESTS_TOO=1 RUN_SSL_TESTS=1 pytest /tmp/rq/tests/ --durations=5 -v --log-cli-level 10
|
Loading…
Reference in New Issue