Skip to content

Commit

Permalink
build(repo): push docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed Sep 26, 2021
1 parent 4ee6eac commit 872760f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
13 changes: 7 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,17 @@ jobs:
echo "Docker tags:";
docker images stoplight/spectral --format="{{ .Tag }}";
docker push stoplight/spectral:${GIT_SHA};
if [[ -n "$DOCKER_BRANCH" ]]; then
docker push stoplight/spectral:${DOCKER_BRANCH};
fi
if [[ -n "$CIRCLE_TAG" ]]; then
echo "Pushed stoplight/spectral:${GIT_SHA}";
if [ -n "$CIRCLE_TAG" ]; then
docker push stoplight/spectral:${FULL_VERSION} \
stoplight/spectral:${MINOR_VERSION} \
stoplight/spectral:${MAJOR_VERSION};
echo "Pushed stoplight/spectral:${FULL_VERSION}";
fi
if [ -n "$DOCKER_BRANCH" ]; then
docker push stoplight/spectral:${DOCKER_BRANCH};
echo "Pushed stoplight/spectral:${DOCKER_BRANCH}";
fi
release:
docker:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ FROM node:16-alpine
WORKDIR /usr/src/spectral

COPY scripts/install.sh /usr/src/spectral/
RUN ls -l
RUN apk --no-cache add curl
RUN ./install.sh
RUN rm ./install.sh
COPY packages/cli/package.json /usr/src/spectral/
RUN apk --no-cache add curl jq
RUN ./install.sh $(cat package.json | jq -r '.version') \
&& rm ./install.sh && rm ./package.json
ENV NODE_ENV production

ENTRYPOINT [ "spectral" ]
12 changes: 10 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh


VERSION=${1:-latest};

install () {

set -eu
Expand All @@ -24,7 +27,12 @@ elif [ "$UNAME" = "Linux" ] ; then
fi
fi

URL="https://github.com/stoplightio/spectral/releases/latest/download/${FILENAME}"
if [ "$VERSION" == "latest" ] ; then
URL="https://github.com/stoplightio/spectral/releases/latest/download/${FILENAME}"
else
URL="https://github.com/stoplightio/spectral/releases/download/v${VERSION}/${FILENAME}"
fi

SRC="$(pwd)/${FILENAME}"
DEST=/usr/local/bin/spectral

Expand All @@ -40,4 +48,4 @@ else
fi
}

install
install

0 comments on commit 872760f

Please sign in to comment.