Skip to content

Commit

Permalink
docker and cloudbuild setup for running tox
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Nov 26, 2019
1 parent c761578 commit f8a8e81
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
**/__pycache__
.pytest_cache
.prereqs_cache
**/*.pyc
3 changes: 3 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
**/__pycache__
**/*.pyc
63 changes: 63 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
FROM ubuntu:16.04

RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
apt-transport-https \
build-essential \
gcc \
g++ \
gettext \
git \
git-core \
gfortran \
golang \
graphviz \
graphviz-dev \
language-pack-en \
libblas-dev \
liblapack-dev \
libatlas-base-dev \
libfreetype6-dev \
libssl-dev \
libffi-dev \
libgeos-dev \
libjpeg8-dev \
libsqlite3-dev \
libmysqlclient-dev \
libpng12-dev \
libpq-dev \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
memcached \
mongodb \
openssl \
pkg-config \
python-apt \
python-dev \
python-mysqldb \
python-cryptography \
python-pip \
python-setuptools \
python-virtualenv \
software-properties-common \
swig \
&& pip install setuptools -U \
&& pip install virtualenv \
&& pip install more-itertools==5.0.0 \
&& pip install tox

# COPY nodesource.gpg.key /tmp/nodesource.gpg.key
# RUN apt-key add /tmp/nodesource.gpg.key \
# && echo 'deb https://deb.nodesource.com/node_8.x xenial main' > /etc/apt/sources.list.d/nodesource.list \
# && echo 'deb-src https://deb.nodesource.com/node_8.x xenial main' >> /etc/apt/sources.list.d/nodesource.list \
# && apt-get update \
# && apt-get install -y nodejs

WORKDIR /app
COPY . /app

ENTRYPOINT ["/app/scripts/docker_tox.sh"]
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ upgrade: ## update the pip requirements files to use the latest releases satisfy
grep "^django==" requirements/edx/base.txt > requirements/edx/django.txt
sed '/^[dD]jango==/d' requirements/edx/testing.txt > requirements/edx/testing.tmp
mv requirements/edx/testing.tmp requirements/edx/testing.txt

.PHONY: docker-tox
docker-tox:
docker build . -t edx-platform-tox
docker run edx-platform-tox

.PHONY: cloudbuild
cloudbuild:
gcloud builds submit --config cloudbuild.yaml . --project=appsembler-infrastructure
8 changes: 8 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/appsembler-infrastructure/edx-platform-tox', '.']
- name: 'gcr.io/cloud-builders/docker'
args: ['run', 'gcr.io/appsembler-infrastructure/edx-platform-tox']

images: ['gcr.io/appsembler-infrastructure/edx-platform-tox']
timeout: 7200s
10 changes: 10 additions & 0 deletions scripts/docker_tox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

mkdir -p /data/db
mongod --fork --logpath /tmp/mongod.log

# Clear the mongo database
# Note that this prevents us from running jobs in parallel on a single worker.
mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSiblingDB(i).dropDatabase()})'

tox

0 comments on commit f8a8e81

Please sign in to comment.