[go: up one dir, main page]

Skip to content

Commit

Permalink
Merge pull request #2 from apiaryio/honzajavorek/remove-race-condition
Browse files Browse the repository at this point in the history
Simplify Dockerfile and remove race condition
  • Loading branch information
honzajavorek committed Oct 5, 2018
2 parents 01b6011 + 2269430 commit dd1613a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ language: "generic"
services:
- "docker"
script:
- "export DREDD_VERSION=$(npm view dredd version)"
- "bash build.sh"
deploy:
provider: "script"
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ MAINTAINER Apiary <sre@apiary.io>

ARG DREDD_VERSION=latest
RUN echo ${DREDD_VERSION}
RUN apk add --no-cache make gcc g++ python git
RUN npm config set loglevel error
RUN npm install dredd@${DREDD_VERSION}
RUN apk del make gcc g++ python
RUN apk add --no-cache make gcc g++ python git && \
npm config set loglevel error && \
npm install dredd@${DREDD_VERSION} && \
apk del make gcc g++ python
ENV PATH ${PATH}:/node_modules/.bin

CMD ["dredd"]
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
DREDD_VERSION=$(npm view dredd version)
set -e

if [ -z "$DREDD_VERSION" ]; then
echo "You need to set the DREDD_VERSION environment variable before running this script"
exit 1
fi
echo "Building version: $DREDD_VERSION"

docker build \
-t "apiaryio/dredd:$DREDD_VERSION" \
--build-arg DREDD_VERSION="$DREDD_VERSION" \
Expand Down
8 changes: 7 additions & 1 deletion docker_push.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
DREDD_VERSION=$(npm view dredd version)
set -e

if [ -z "$DREDD_VERSION" ]; then
echo "You need to set the DREDD_VERSION environment variable before running this script"
exit 1
fi
echo "Building version: $DREDD_VERSION"

echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push "apiaryio/dredd:$DREDD_VERSION"
docker push apiaryio/dredd:latest
Expand Down

0 comments on commit dd1613a

Please sign in to comment.