Skip to content

Instantly share code, notes, and snippets.

@kekru
Last active May 30, 2019 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kekru/f650dc96fd85f0fb7dcacea6f8d216ea to your computer and use it in GitHub Desktop.
Save kekru/f650dc96fd85f0fb7dcacea6f8d216ea to your computer and use it in GitHub Desktop.
Dockerfile for container-structure-test

Dockerfile for container-structure-test

Use the following docker-compose file. It will build directly from this gist.
To be more stable, copy the Dockerfile and build on your own.

version: "3.3"

services:
  structure-test:
    build: https://gist.github.com/kekru/f650dc96fd85f0fb7dcacea6f8d216ea.git
    image: structure-test
    environment:
     - TEST_IMAGE=image-to-test
     - TEST_CONFIG=/test.yml
    volumes:
     - ./test.yml:/test.yml:ro
     - /var/run/docker.sock:/var/run/docker.sock:ro 

Be sure that you have a test.yml beside your docker-compose.yml, which defines your container-structure-test config.
Replace image-to-test with the image's name, that you want to test.

Start the test with docker-compose run structure-test

FROM alpine:3.9
RUN apk add --no-cache curl
RUN curl -LO https://storage.googleapis.com/container-structure-test/v1.8.0/container-structure-test-linux-amd64 \
&& chmod +x container-structure-test-linux-amd64 \
&& mv container-structure-test-linux-amd64 /usr/local/bin/cst
WORKDIR /data
ENV TEST_CONFIG=test.yml \
TEST_IMAGE=""
CMD cst test --image $TEST_IMAGE --config $TEST_CONFIG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment