Skip to content

Commit

Permalink
Chore: Set Docker image tag to latest only when really latest (Rocket…
Browse files Browse the repository at this point in the history
  • Loading branch information
debdutdeb authored Feb 1, 2022
1 parent dfd22ee commit 5c6edf0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
22 changes: 11 additions & 11 deletions .docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ RUN apk add --no-cache python3 make g++ libc6-compat ttf-dejavu

ADD . /app

MAINTAINER [email protected]
LABEL maintainer="[email protected]"

RUN set -x \
&& cd /app/bundle/programs/server \
&& npm install --production \
# Start hack for sharp...
&& rm -rf npm/node_modules/sharp \
&& npm install [email protected] \
&& mv node_modules/sharp npm/node_modules/sharp \
# End hack for sharp
&& cd npm \
&& npm rebuild bcrypt --build-from-source \
&& npm cache clear --force
&& cd /app/bundle/programs/server \
&& npm install --production \
# Start hack for sharp...
&& rm -rf npm/node_modules/sharp \
&& npm install [email protected] \
&& mv node_modules/sharp npm/node_modules/sharp \
# End hack for sharp
&& cd npm \
&& npm rebuild bcrypt --build-from-source \
&& npm cache clear --force

# needs a mongo instance - defaults to container linking with alias 'mongo'
ENV DEPLOY_METHOD=docker \
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,20 @@ jobs:
docker build -t $IMAGE_NAME:$DOCKER_TAG .
docker push $IMAGE_NAME:$DOCKER_TAG
# build and push the broader alias tag
docker tag $IMAGE_NAME:$DOCKER_TAG $IMAGE_NAME:$RELEASE
docker push $IMAGE_NAME:$RELEASE
if [[ $RELEASE == 'latest' ]]; then
CURRENT_LATEST="$(
git -c 'versionsort.suffix=-' ls-remote -t --exit-code --refs --sort=-v:refname "https://github.com/$GITHUB_REPOSITORY" '*' |
sed -En '1!q;s/^[[:xdigit:]]+[[:space:]]+refs\/tags\/(.+)/\1/gp'
)"
echo "CURRENT_LATEST: $CURRENT_LATEST"
if [[ $CURRENT_LATEST == $GITHUB_REF_NAME ]]; then
docker tag $IMAGE_NAME:$DOCKER_TAG $IMAGE_NAME:$RELEASE
docker push $IMAGE_NAME:$RELEASE
fi
else
docker tag $IMAGE_NAME:$DOCKER_TAG $IMAGE_NAME:$RELEASE
docker push $IMAGE_NAME:$RELEASE
fi
- name: Build Docker image for develop
if: github.ref == 'refs/heads/develop'
Expand Down

0 comments on commit 5c6edf0

Please sign in to comment.