Skip to content

Commit

Permalink
Add dart to path (#53)
Browse files Browse the repository at this point in the history
* Make sure dart is actually available as a command

Added some basic acceptance testing to the final stages of the image
build to help us catch things like this in the future.

* Update CHANGELOG
  • Loading branch information
mattwynne committed Aug 16, 2021
1 parent 58df71c commit 10c7237
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.local-image
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add dart to path ([#53](https://github.com/cucumber/build/pull/53))

## [0.7.0] - 2021-07-29
### Changed
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ RUN apt-get update && apt-get install wget
COPY scripts/install-dart.sh .
RUN bash ./install-dart.sh
RUN rm ./install-dart.sh
ENV PATH="${PATH}:/usr/lib/dart-sdk/bin"

# Run some tests on the image
COPY scripts/acceptance-test-for-image.sh .
RUN bash ./acceptance-test-for-image.sh
RUN rm ./acceptance-test-for-image.sh

USER $USER

Expand Down
25 changes: 15 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
NAME := cucumber/cucumber-build
DEFAULT_PLATFORM = $(shell [ $$(arch) = "arm64" ] && echo "linux/arm64" || echo "linux/amd64")
PLATFORMS ?= ${DEFAULT_PLATFORM}
RUN_CMD ?=bash

default:
default: /tmp/.buildx-cache-new/index.json Dockerfile
.PHONY: default

/tmp/.buildx-cache-new/index.json: Dockerfile
docker buildx build \
--cache-to="type=local,dest=/tmp/.buildx-cache-new" \
--cache-from="type=local,src=/tmp/.buildx-cache" \
--platform=${PLATFORMS} \
--tag ${NAME}:latest .
.PHONY: default

local:
docker buildx build --platform=${PLATFORMS} --tag ${NAME}:latest --load .
local: /tmp/.buildx-cache-new/index.json .local-image
.PHONY: local

docker-push: default
echo "Deprecated. Please submit a pull request to the `release` branch to have your changes released."
.PHONY: docker-push

docker-run: local
docker run \
--volume "${HOME}/.m2/repository":/home/cukebot/.m2/repository \
--user 1000 \
--rm \
-it ${NAME} \
bash
.PHONY:
$(1)

.local-image:
docker buildx build --platform=${PLATFORMS} --tag ${NAME}:latest --load .
touch $@

clean:
rm .local-image
.PHONY: clean
7 changes: 7 additions & 0 deletions scripts/acceptance-test-for-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set -e
#
# Runs some commands within the build image to validate basic expecations about what should be working.
#

which go || (echo "command 'go' not found" && exit 1)
which dart || (echo "command 'dart' not found" && exit 1)
3 changes: 0 additions & 3 deletions scripts/install-dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,5 @@ unzip -d /usr/lib $tzip > /dev/null
chown -R cukebot /usr/lib/dart-sdk
chmod -R +rx /usr/lib/dart-sdk

# Adding dart to path
export PATH="$PATH:/usr/lib/dart-sdk/bin"

# Removing tmp files
rm -r "$tdir"

0 comments on commit 10c7237

Please sign in to comment.