aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml14
-rw-r--r--Pipfile7
-rw-r--r--docker/base.Dockerfile (renamed from docker/Dockerfile.base)2
-rw-r--r--docker/bot.Dockerfile (renamed from docker/Dockerfile)6
-rw-r--r--scripts/deploy.sh10
5 files changed, 22 insertions, 17 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3edfb2bf8..f7aee8165 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,12 +1,14 @@
image: pythondiscord/bot-ci:latest
variables:
- PIPENV_CACHE_DIR: "$CI_PROJECT_DIR/pipenv-cache"
+ PIPENV_CACHE_DIR: "/root/.cache/pipenv"
+ PIP_CACHE_DIR: "/root/.cache/pip"
cache:
paths:
- - "$CI_PROJECT_DIR/pipenv-cache"
- - "$CI_PROJECT_DIR/.venv"
+ - "/root/.cache/pip/"
+ - "/root/.cache/pipenv/"
+ - "/usr/local/lib/python3.6/site-packages/"
stages:
- test
@@ -19,8 +21,10 @@ test:
stage: test
script:
- - pipenv install --dev --deploy
- - pipenv run lint
+ - ls /root/.cache/
+ - pipenv install --dev --deploy --system
+ - python -m flake8
+ - ls /root/.cache/
build:
tags:
diff --git a/Pipfile b/Pipfile
index b6f7aeb6f..d3d315e6e 100644
--- a/Pipfile
+++ b/Pipfile
@@ -40,9 +40,12 @@ python_version = "3.6"
[scripts]
start = "python -m bot"
lint = "python -m flake8"
-build = "docker build -t pythondiscord/bot:latest -f docker/Dockerfile ."
+
+build = "docker build -t pythondiscord/bot:latest -f docker/bot.Dockerfile ."
push = "docker push pythondiscord/bot:latest"
-buildbase = "docker build -t pythondiscord/bot-base:latest -f docker/Dockerfile.base ."
+
+buildbase = "docker build -t pythondiscord/bot-base:latest -f docker/base.Dockerfile ."
pushbase = "docker push pythondiscord/bot-base:latest"
+
buildci = "docker build -t pythondiscord/bot-ci:latest -f docker/ci.Dockerfile ."
pushci = "docker push pythondiscord/bot-ci:latest"
diff --git a/docker/Dockerfile.base b/docker/base.Dockerfile
index 2f6929e0d..de2c68c13 100644
--- a/docker/Dockerfile.base
+++ b/docker/base.Dockerfile
@@ -22,6 +22,6 @@ ENV PIPENV_IGNORE_VIRTUALENVS=1
ENV PIPENV_NOSPIN=1
ENV PIPENV_HIDE_EMOJIS=1
-RUN pipenv install
+RUN pipenv install --deploy --system
# usage: FROM pythondiscord/bot-base:latest
diff --git a/docker/Dockerfile b/docker/bot.Dockerfile
index 2db1ee24a..4713e1f0e 100644
--- a/docker/Dockerfile
+++ b/docker/bot.Dockerfile
@@ -5,12 +5,10 @@ ENV PIPENV_IGNORE_VIRTUALENVS=1
ENV PIPENV_NOSPIN=1
ENV PIPENV_HIDE_EMOJIS=1
-RUN pip install pipenv
-
COPY . /bot
WORKDIR /bot
-RUN pipenv sync
+RUN pipenv install --deploy --system
ENTRYPOINT ["/sbin/tini", "--"]
-CMD ["pipenv", "run", "start"]
+CMD ["python", "-m", "bot"]
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
index 50ec87f59..070d0ec26 100644
--- a/scripts/deploy.sh
+++ b/scripts/deploy.sh
@@ -5,22 +5,22 @@ if [[ $CI_COMMIT_REF_SLUG == 'master' ]]; then
echo "Connecting to docker hub"
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- changed_lines=$(git diff HEAD~1 HEAD docker/Dockerfile.base | wc -l)
+ changed_lines=$(git diff HEAD~1 HEAD docker/base.Dockerfile | wc -l)
if [ $changed_lines != '0' ]; then
- echo "Dockerfile.base was changed"
+ echo "base.Dockerfile was changed"
echo "Building bot base"
- docker build -t pythondiscord/bot-base:latest -f docker/Dockerfile.base .
+ docker build -t pythondiscord/bot-base:latest -f docker/base.Dockerfile .
echo "Pushing image to Docker Hub"
docker push pythondiscord/bot-base:latest
else
- echo "Dockerfile.base was not changed, not building"
+ echo "base.Dockerfile was not changed, not building"
fi
echo "Building image"
- docker build -t pythondiscord/bot:latest -f docker/Dockerfile .
+ docker build -t pythondiscord/bot:latest -f docker/bot.Dockerfile .
echo "Pushing image"
docker push pythondiscord/bot:latest