diff options
| -rw-r--r-- | .dockerignore | 8 | ||||
| -rw-r--r-- | azure-pipelines.yml | 30 | ||||
| -rw-r--r-- | docker/Dockerfile | 30 | ||||
| -rw-r--r-- | docker/docker-compose.yml | 3 | 
4 files changed, 37 insertions, 34 deletions
| diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..159e4f4c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# Exclude everything +* + +# Make exceptions for what's needed +!bot +!Pipfile +!Pipfile.lock +!LICENSE diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f81f1139..c98bc4fc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,12 +1,5 @@  # https://aka.ms/yaml -variables: -  LIBRARY_PATH: /lib:/usr/lib -  PIPENV_HIDE_EMOJIS: 1 -  PIPENV_IGNORE_VIRTUALENVS: 1 -  PIPENV_NOSPIN: 1 -  PIPENV_VENV_IN_PROJECT: 1 -  jobs:  - job: test    displayName: 'Lint & Test' @@ -15,37 +8,34 @@ jobs:      vmImage: 'Ubuntu 16.04'    variables: -    PIPENV_CACHE_DIR: ".cache/pipenv"      PIP_CACHE_DIR: ".cache/pip"      PIP_SRC: ".cache/src" +    PIPENV_CACHE_DIR: ".cache/pipenv" +    PIPENV_DONT_USE_PYENV: 1 +    PIPENV_HIDE_EMOJIS: 1 +    PIPENV_IGNORE_VIRTUALENVS: 1 +    PIPENV_NOSPIN: 1    steps: -  - script: sudo apt-get install build-essential curl docker libffi-dev libfreetype6-dev libxml2 libxml2-dev libxslt1-dev zlib1g zlib1g-dev -    displayName: 'Install base dependencies' -    - task: UsePythonVersion@0      displayName: 'Set Python version'      inputs:        versionSpec: '3.7.x'        addToPath: true -  - script: sudo pip install pipenv +  - script: pip3 install pipenv      displayName: 'Install pipenv'    - script: pipenv install --dev --deploy --system      displayName: 'Install project using pipenv' -  - script: python -m flake8 +  - script: python3 -m flake8      displayName: 'Run linter'  - job: build    displayName: 'Build Containers'    dependsOn: 'test' -  variables: -    PIPENV_CACHE_DIR: ".cache/pipenv" -    PIP_CACHE_DIR: ".cache/pip" -    steps:    - task: Docker@1      displayName: 'Login: Docker Hub' @@ -55,12 +45,6 @@ jobs:        dockerRegistryEndpoint: 'DockerHub'        command: 'login' -  - script: sudo apt-get install python3-setuptools -    displayName: 'Install setuptools' - -  - script: sudo pip3 install salt-pepper -    displayName: 'Install pepper' -    - task: ShellScript@2      displayName: 'Build and deploy containers' diff --git a/docker/Dockerfile b/docker/Dockerfile index edeb5b50..1445441c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,15 +1,25 @@ -FROM python:3.7-alpine3.7 -RUN apk add --update libffi-dev tini build-base git jpeg-dev zlib zlib-dev +FROM python:3.7.2-alpine3.9 -RUN mkdir /bot -COPY . /bot -WORKDIR /bot +ENTRYPOINT ["python"] +CMD ["-m", "bot"] -ENV LIBRARY_PATH=/lib:/usr/lib \ -    PIPENV_VENV_IN_PROJECT=1 +ENV PIP_NO_CACHE_DIR="false" \ +    PIPENV_DONT_USE_PYENV="1" \ +    PIPENV_HIDE_EMOJIS="1" \ +    PIPENV_IGNORE_VIRTUALENVS="1" \ +    PIPENV_NOSPIN="1" +RUN apk add --no-cache --update \ +        build-base \ +        git \ +        libffi-dev \ +        # Pillow dependencies +        freetype-dev \ +        libjpeg-turbo-dev \ +        zlib-dev  RUN pip install pipenv -RUN pipenv install --deploy --system -ENTRYPOINT ["/sbin/tini", "--"] -CMD ["python", "-m", "bot"] +COPY . /bot +WORKDIR /bot + +RUN pipenv install --deploy --system diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index de1f4cf2..6e274451 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,8 +1,9 @@ -version: "3" +version: "3.7"  services:    dumbo:      image: pythondiscord/seasonalbot:latest      container_name: seasonalbot +    init: true      restart: always | 
