Skip to content
Snippets Groups Projects
Verified Commit 76c410c9 authored by Erwan Rouchet's avatar Erwan Rouchet
Browse files

Remove the shell docker image

parent c70bb59e
No related branches found
No related tags found
1 merge request!669Remove the shell docker image
......@@ -6,7 +6,6 @@ COMMON_BRANCH=master
VERSION=$(shell git rev-parse --short HEAD)
TAG_APP=arkindex-app
TAG_SHELL=arkindex-shell
.PHONY: build base
all: clean build
......@@ -26,15 +25,10 @@ build:
python setup.py sdist
docker build --no-cache $(ROOT_DIR) -t $(TAG_APP):$(VERSION) -t $(TAG_APP):latest --build-arg PONOS_BRANCH=$(PONOS_BRANCH) --build-arg COMMON_BRANCH=$(COMMON_BRANCH)
build-shell:
docker build -t $(TAG_SHELL):$(VERSION) -t $(TAG_SHELL):latest $(ROOT_DIR)/shell
publish-version: require-docker-auth
[ -f $(ROOT_DIR)/arkindex/project/local_settings.py ] && mv $(ROOT_DIR)/arkindex/project/local_settings.py $(ROOT_DIR)/arkindex/project/local_settings.py.bak || true
$(MAKE) build TAG_APP=registry.gitlab.com/arkindex/backend
$(MAKE) build-shell TAG_SHELL=registry.gitlab.com/arkindex/backend/shell
docker push registry.gitlab.com/arkindex/backend:$(VERSION)
docker push registry.gitlab.com/arkindex/backend/shell:$(VERSION)
[ -f $(ROOT_DIR)/arkindex/project/local_settings.py.bak ] && mv $(ROOT_DIR)/arkindex/project/local_settings.py.bak $(ROOT_DIR)/arkindex/project/local_settings.py || true
latest:
......@@ -44,7 +38,6 @@ release:
$(eval version:=$(shell cat VERSION))
$(MAKE) publish-version VERSION=$(version)
docker push registry.gitlab.com/arkindex/backend:latest
docker push registry.gitlab.com/arkindex/backend/shell:latest
git tag $(version)
tunnel:
......
FROM registry.gitlab.com/arkindex/backend:latest
ENV POSTGRES_RO 1
RUN apk add postgresql-client
RUN pip install ipython django_extensions
COPY start.sh /start.sh
ENTRYPOINT ["/start.sh"]
CMD ["shell_plus"]
#!/bin/sh
DB_HOST=${DB_HOST:-localhost}
DB_PORT=${DB_PORT:-9100}
DB_NAME=${DB_NAME:-arkindex_dev}
DB_USER=${DB_USER:-devuser}
DB_PASSWORD=${DB_PASSWORD:-devdata}
RO_USER=${RO_USER:-rouser}
RO_PASSWORD=${RO_PASSWORD:-ropassword}
# Create the read-only user if it does not exist
export PGPASSWORD="$DB_PASSWORD"
psql -h $DB_HOST -U $DB_USER -p $DB_PORT -tc "SELECT 1 FROM pg_user WHERE usename = '$RO_USER'" postgres | grep -q 1 || (
psql -h $DB_HOST -U $DB_USER -p $DB_PORT -c "CREATE ROLE $RO_USER LOGIN PASSWORD '$RO_PASSWORD'; GRANT CONNECT ON DATABASE $DB_NAME TO $RO_USER" postgres
psql -h $DB_HOST -U $DB_USER -p $DB_PORT -c "GRANT USAGE ON SCHEMA public TO $RO_USER; GRANT SELECT ON ALL TABLES IN SCHEMA public TO $RO_USER; GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO $RO_USER; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO $RO_USER; ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON SEQUENCES TO $RO_USER" $DB_NAME
)
# Override database credentials
export PGPASSWORD=
export DB_USER="$RO_USER"
export DB_PASSWORD="$RO_PASSWORD"
manage.py "$@"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment