Commit 0ccd5d0f authored by Bruce Flynn's avatar Bruce Flynn

Docker CI testing, attempt 1

parent b38acd3b
Pipeline #2351 passed with stages
in 2 minutes and 14 seconds
variables:
DOCKER_CMD: docker-compose -p amrc_aws
services:
- postgres:9.5
variables:
POSTGRES_DB: __awsapi_test
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
AWSAPI_DB_URL: postgresql://runner@postgres/__awsapi_test
build:
stage: build
script:
- ${DOCKER_CMD} build app
test:
image: brucef/py3test
script:
- pip install git+https://gitlab.ssec.wisc.edu/metobs/MetObsData.git@0.5
- pip install -i https://sips.ssec.wisc.edu/eggs -e ".[testing]"
- py.test
stage: test
before_script:
- ${DOCKER_CMD} up -d db
- sleep 5
script:
- ${DOCKER_CMD} run --rm app py.test -v
after_script:
- ${DOCKER_CMD} down --remove-orphan
FROM debian
# minimal deps required to install miniconda and compile py-exts
RUN apt-get update && apt-get -y install \
bzip2 \
curl \
gcc \
git \
libx11-6
# install Miniconda3
WORKDIR /tmp
RUN curl -o installer.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
bash installer.sh -b -p /miniconda && \
rm installer.sh
# install deps that tend to cause issues via conda
RUN /miniconda/bin/conda install -y psycopg2 curl
# put miniconda bins first on the path
ENV PATH /miniconda/bin:$PATH
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code
RUN pip install -r requirements.txt
COPY stations.yaml /code
COPY amrc_aws /code/amrc_aws
COPY setup.py /code/setup.py
# .git is required for setuptools_scm to determine version.
COPY .git /code/.git
RUN pip install -e ".[testing]"
COPY tests /code/tests
RUN find /code -name __pycache__ | xargs -n1 rm -rf
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN conda clean -y --all
......@@ -17,4 +17,4 @@ DB_URL = getenv('AWSAPI_DB_URL', 'postgresql://apiadmin@/aws')
STATION_DB = getenv('AWSAPI_STATION_DB', 'stations.yaml')
if not os.path.exists(STATION_DB):
raise EnvironmentError('Station db {:s} does not exist'.format(STATION_DB))
raise EnvironmentError("Station db '{:s}' does not exist".format(STATION_DB))
version: "2"
services:
app:
build:
context: .
environment:
AWSAPI_DB_URL: postgresql://docker@db/__test
db:
environment:
- POSTGRES_USER=docker
- POSTGRES_DB=__test
image: postgres:9.6
ports:
- 15432:5432
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment