Skip to content

Commit

Permalink
fix: add scripts, update for slim, better naming
Browse files Browse the repository at this point in the history
add 'build.sh' and 'test.sh' utility scripts
use 'update' before 'install' in slim images
use <purpose>.Dockerfile form for naming
  • Loading branch information
Moshe Pontch committed Sep 15, 2019
1 parent 99c1c7f commit b94b9d5
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 8 deletions.
7 changes: 0 additions & 7 deletions Dockerfile-node-6-slim

This file was deleted.

16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker Goof

Open a terminal and open the `docker-goof` directory.
Open a terminal at the `docker-goof` directory.

1. Build the image

Expand All @@ -23,6 +23,20 @@ docker build -t docker-goof . && \
snyk test --docker docker-goof --file=Dockerfile
```

## Utility scripts

To build all images:

```console
./build.sh
```

To test all images:

```console
./test.sh
```

## Screenshots

All of these screenshots demonstrate the extra value provided when a
Expand Down
15 changes: 15 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

pushd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" >/dev/null

for f in $(ls *Dockerfile); do
base=$(basename ${f})
flavour=${base%.Dockerfile}
flavour=${flavour%Dockerfile}
tag=docker-goof${flavour:+-$flavour}
file=${flavour:+-f $base}
echo Building ${tag}...
docker build -q -t ${tag} . ${file}
done

popd >/dev/null
5 changes: 5 additions & 0 deletions n6-slim-fw.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:6.14.1-slim

RUN apt-get update
RUN apt-get install -y firewalld beep
RUN apt-get install -y imagemagick
4 changes: 4 additions & 0 deletions n6-slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM node:6.14.2-slim

RUN apt-get update -y
RUN apt-get install -y imagemagick
1 change: 1 addition & 0 deletions Dockerfile-node-slim → slim.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM node:10.4.0-slim

RUN apt-get update
RUN apt-get install -y imagemagick
14 changes: 14 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

pushd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" >/dev/null

for f in $(ls *Dockerfile); do
base=$(basename ${f})
flavour=${base%.Dockerfile}
flavour=${flavour%Dockerfile}
tag=docker-goof${flavour:+-$flavour}
echo Testing ${tag}...
snyk test --docker ${tag} --file=${base}
done

popd >/dev/null
1 change: 1 addition & 0 deletions Dockerfile-wp → wp.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM wordpress:5

RUN apt-get update
RUN apt-get install -y imagemagick

0 comments on commit b94b9d5

Please sign in to comment.