Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit eaabaac

Browse files
authored
Merge pull request #16 from chris-crone/ci-lint-docker-only
Make ci-lint only depend on Docker
2 parents acd9866 + bc8aad6 commit eaabaac

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Dockerfile.lint

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
ARG GO_VERSION=1.10
1+
ARG GO_VERSION=1.10.1
22
ARG RUN_BASE_TAG=3.7
3-
ARG BUILD_BASE_TAG=${GO_VERSION}-alpine${RUN_BASE_TAG}
43

5-
FROM golang:${BUILD_BASE_TAG}
4+
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS lint-base
65
RUN apk add --no-cache \
76
curl \
87
git
@@ -26,4 +25,9 @@ ENV CGO_ENABLED=0
2625
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
2726
ENTRYPOINT ["/usr/local/bin/gometalinter"]
2827
CMD ["--config=gometalinter.json", "./..."]
28+
29+
FROM lint-base AS lint-volume
2930
VOLUME ["/go/src/github.com/docker/lunchbox"]
31+
32+
FROM lint-base AS lint-image
33+
COPY . .

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ test check: lint unit-test e2e-test
5151

5252
lint:
5353
@echo "Linting..."
54-
@tar -c Dockerfile.lint gometalinter.json | docker build -t $(IMAGE_NAME)-lint $(IMAGE_BUILD_ARGS) -f Dockerfile.lint - > /dev/null
55-
@docker run --rm -v $(dir $(realpath $(lastword $(MAKEFILE_LIST)))):/go/src/$(PKG_NAME) $(IMAGE_NAME)-lint
54+
@tar -c Dockerfile.lint gometalinter.json | docker build -t $(IMAGE_NAME)-lint $(IMAGE_BUILD_ARGS) -f Dockerfile.lint - --target=lint-volume > /dev/null
55+
@docker run --rm -v $(dir $(realpath $(lastword $(MAKEFILE_LIST)))):/go/src/$(PKG_NAME):ro $(IMAGE_NAME)-lint
5656

5757
e2e-test:
5858
@echo "Running e2e tests..."
@@ -69,9 +69,13 @@ clean:
6969
# CI #
7070
######
7171

72-
ci-lint: lint
72+
ci-lint:
73+
@echo "Linting..."
74+
docker build -t $(IMAGE_NAME)-lint $(IMAGE_BUILD_ARGS) -f Dockerfile.lint . --target=lint-image
75+
docker run --rm $(IMAGE_NAME)-lint
7376

7477
ci-test:
78+
@echo "Testing..."
7579
docker build -t $(IMAGE_NAME)-test $(IMAGE_BUILD_ARGS) . --target=test
7680

7781
ci-bin-%:

0 commit comments

Comments
 (0)