fix docker img publish routine

This commit is contained in:
realaravinth 2021-12-06 13:45:33 +05:30
parent 7c19ec4f51
commit 005d69d80f
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
4 changed files with 48 additions and 50 deletions

View file

@ -37,30 +37,30 @@ jobs:
profile: minimal
override: false
- name: install virtualenv
run: pip install virtualenv
# - name: install virtualenv
# run: pip install virtualenv
#
# - name: install dependencies
# run: make env
# # - name: build docker image
# run: make docker-build
#
#- name: start docker container
# run: make docker-run
- name: install dependencies
run: make env
#- name: run tests
# run: make test
- name: build docker image
run: make docker-build
- name: start docker container
run: make docker-run
- name: run tests
run: make test
- name: stop docker container
run: make docker-stop
#- name: stop docker container
# run: make docker-stop
- name: Login to DockerHub
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/pages'
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/cache'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: mcaptcha
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and publish docker images
if: (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'mCaptcha/cache'
run: make docker

View file

@ -6,7 +6,7 @@ ARG OSNICK=bullseye
# ARCH=x64|arm64v8|arm32v7
ARG ARCH=x64
FROM rust:1-bullseye as builder
FROM rust:1.57-bullseye as builder
WORKDIR /src
RUN set -ex; \
apt-get update; \
@ -16,6 +16,7 @@ COPY Cargo.toml Cargo.lock /src/
RUN mkdir -p /src/src && touch /src/src/lib.rs
RUN cargo build --release
COPY . .
RUN cargo build --release
#FROM redisfab/redis:${REDIS_VER}-${ARCH}-${OSNICK}

View file

@ -1,6 +1,4 @@
VERSION = "0.1.0:alpha-test"
DOCKER_IMG = "mcaptcha/cache$(VERSION)"
DOCKER_CONTAINER = "mcaptcha_cache_test"
DOCKER_CONTAINER = "test_instance"
default:
cargo build --release
@ -21,17 +19,18 @@ doc:
cargo doc --no-deps --workspace --all-features --document-private-items
docker:
docker build -t mcaptcha/cache:0.1.0-beta -t mcaptcha/cache:latest .
docker push mcaptcha/cache:0.1.0-beta
docker push mcaptcha/cache:latest
docker build -t mcaptcha/cache:broken-build .
#docker build -t mcaptcha/cache:0.1.0-beta -t mcaptcha/cache:latest .
#docker push mcaptcha/cache:0.1.0-beta
docker push mcaptcha/cache:broken-build
docker-build:
docker build -t $(DOCKER_IMG) .
docker build -t mcaptcha/cache:0.1.0-beta -t mcaptcha/cache:latest .
docker-run:
docker run --detach --name=$(DOCKER_CONTAINER) \
docker run --name=$(DOCKER_CONTAINER) \
--publish 6379:6379 \
$(DOCKER_IMG)
mcaptcha/cache:latest
docker-stop:
docker stop $(DOCKER_CONTAINER) || true
@ -43,6 +42,7 @@ env:
@-pip install codespell
test:
@ . venv/bin/activate && ./scripts/spellcheck.sh -c
cargo test --all --all-features --no-fail-fast
./tests/test.py

View file

@ -14,6 +14,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#![allow(clippy::not_unsafe_ptr_arg_deref)]
use lazy_static::lazy_static;
use redis_module::NotifyEvent;
use redis_module::{redis_command, redis_event_handler, redis_module};
@ -78,27 +80,22 @@ pub fn on_delete(ctx: &Context, event_type: NotifyEvent, event: &str, key_name:
}
}
#[allow(clippy::not_unsafe_ptr_arg_deref)]
pub mod redis {
use super::*;
redis_module! {
name: "mcaptcha_cahce",
version: PKG_VERSION,
data_types: [MCAPTCHA_BUCKET_TYPE, MCAPTCHA_MCAPTCHA_TYPE, MCAPTCHA_SAFETY_TYPE, MCAPTCHA_CHALLENGE_TYPE],
commands: [
["MCAPTCHA_CACHE.ADD_VISITOR", bucket::Bucket::counter_create, "write", 1, 1, 1],
["MCAPTCHA_CACHE.GET", mcaptcha::MCaptcha::get_count, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.ADD_CAPTCHA", mcaptcha::MCaptcha::add_captcha, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.DELETE_CAPTCHA", mcaptcha::MCaptcha::delete_captcha, "write", 1, 1, 1],
["MCAPTCHA_CACHE.RENAME_CAPTCHA", mcaptcha::MCaptcha::rename, "write", 1, 1, 1],
["MCAPTCHA_CACHE.CAPTCHA_EXISTS", mcaptcha::MCaptcha::captcha_exists, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.ADD_CHALLENGE", challenge::Challenge::create_challenge, "write", 1, 1, 1],
["MCAPTCHA_CACHE.GET_CHALLENGE", challenge::Challenge::get_challenge, "write", 1, 1, 1],
["MCAPTCHA_CACHE.DELETE_CHALLENGE", challenge::Challenge::delete_challenge, "write", 1, 1, 1],
],
event_handlers: [
[@EXPIRED @EVICTED: on_delete],
]
}
redis_module! {
name: "mcaptcha_cahce",
version: PKG_VERSION,
data_types: [MCAPTCHA_BUCKET_TYPE, MCAPTCHA_MCAPTCHA_TYPE, MCAPTCHA_SAFETY_TYPE, MCAPTCHA_CHALLENGE_TYPE],
commands: [
["MCAPTCHA_CACHE.ADD_VISITOR", bucket::Bucket::counter_create, "write", 1, 1, 1],
["MCAPTCHA_CACHE.GET", mcaptcha::MCaptcha::get_count, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.ADD_CAPTCHA", mcaptcha::MCaptcha::add_captcha, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.DELETE_CAPTCHA", mcaptcha::MCaptcha::delete_captcha, "write", 1, 1, 1],
["MCAPTCHA_CACHE.RENAME_CAPTCHA", mcaptcha::MCaptcha::rename, "write", 1, 1, 1],
["MCAPTCHA_CACHE.CAPTCHA_EXISTS", mcaptcha::MCaptcha::captcha_exists, "readonly", 1, 1, 1],
["MCAPTCHA_CACHE.ADD_CHALLENGE", challenge::Challenge::create_challenge, "write", 1, 1, 1],
["MCAPTCHA_CACHE.GET_CHALLENGE", challenge::Challenge::get_challenge, "write", 1, 1, 1],
["MCAPTCHA_CACHE.DELETE_CHALLENGE", challenge::Challenge::delete_challenge, "write", 1, 1, 1],
],
event_handlers: [
[@EXPIRED @EVICTED: on_delete],
]
}