Skip to content

Commit 872760f

Browse files
committedSep 26, 2021
build(repo): push docker images
1 parent 4ee6eac commit 872760f

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed
 

‎.circleci/config.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,17 @@ jobs:
212212
echo "Docker tags:";
213213
docker images stoplight/spectral --format="{{ .Tag }}";
214214
docker push stoplight/spectral:${GIT_SHA};
215-
if [[ -n "$DOCKER_BRANCH" ]]; then
216-
docker push stoplight/spectral:${DOCKER_BRANCH};
217-
fi
218-
if [[ -n "$CIRCLE_TAG" ]]; then
215+
echo "Pushed stoplight/spectral:${GIT_SHA}";
216+
if [ -n "$CIRCLE_TAG" ]; then
219217
docker push stoplight/spectral:${FULL_VERSION} \
220218
stoplight/spectral:${MINOR_VERSION} \
221219
stoplight/spectral:${MAJOR_VERSION};
220+
echo "Pushed stoplight/spectral:${FULL_VERSION}";
221+
fi
222+
if [ -n "$DOCKER_BRANCH" ]; then
223+
docker push stoplight/spectral:${DOCKER_BRANCH};
224+
echo "Pushed stoplight/spectral:${DOCKER_BRANCH}";
222225
fi
223-
224-
225226
226227
release:
227228
docker:

‎Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ FROM node:16-alpine
33
WORKDIR /usr/src/spectral
44

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

1212
ENTRYPOINT [ "spectral" ]

‎scripts/install.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/sh
22

3+
4+
VERSION=${1:-latest};
5+
36
install () {
47

58
set -eu
@@ -24,7 +27,12 @@ elif [ "$UNAME" = "Linux" ] ; then
2427
fi
2528
fi
2629

27-
URL="https://github.com/stoplightio/spectral/releases/latest/download/${FILENAME}"
30+
if [ "$VERSION" == "latest" ] ; then
31+
URL="https://github.com/stoplightio/spectral/releases/latest/download/${FILENAME}"
32+
else
33+
URL="https://github.com/stoplightio/spectral/releases/download/v${VERSION}/${FILENAME}"
34+
fi
35+
2836
SRC="$(pwd)/${FILENAME}"
2937
DEST=/usr/local/bin/spectral
3038

@@ -40,4 +48,4 @@ else
4048
fi
4149
}
4250

43-
install
51+
install

0 commit comments

Comments
 (0)
Please sign in to comment.