Skip to content

Commit 414d1b5

Browse files
authored
Add basic dockerfile for k8s testing (#3)
Adds a Dockerfile to help with testing on k8s.
1 parent f76bdcc commit 414d1b5

File tree

7 files changed

+62
-6
lines changed

7 files changed

+62
-6
lines changed

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Dockerfile to build a docker image for containarized platforms.
2+
# The Docker image has:
3+
# - consul-dataplane CLI
4+
# - envoy binary
5+
# - [to-be-included] go-discover CLI
6+
7+
FROM envoyproxy/envoy:v1.23-latest as envoy-binary
8+
9+
FROM golang:1.18-alpine as consul-dataplane-binary
10+
WORKDIR /cdp
11+
# TODO: Directly go install the consul-dataplane CLI once repo is public
12+
COPY cmd ./cmd
13+
COPY pkg ./pkg
14+
COPY internal ./internal
15+
COPY go.mod ./
16+
COPY go.sum ./
17+
RUN go mod download
18+
RUN go build ./cmd/consul-dataplane
19+
# TODO (NET-722): Add go-discover to the docker image once PR
20+
# to fix depencencies is merged. (https://github.com/hashicorp/go-discover/pull/202)
21+
# RUN go get -u github.com/hashicorp/go-discover/cmd/discover
22+
23+
FROM alpine:3.16 as consul-dataplane-container
24+
WORKDIR /root/
25+
RUN apk add gcompat
26+
COPY --from=consul-dataplane-binary /cdp/consul-dataplane ./
27+
COPY --from=envoy-binary /usr/local/bin/envoy /usr/local/bin/envoy
28+
ENTRYPOINT [ "./consul-dataplane" ]

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ copy-bootstrap-config:
1717
gofmt \
1818
> $(BOOTSTRAP_PACKAGE_DIR)/$$file; \
1919
done
20+
21+
.PHONY: unit-tests
22+
unit-tests:
23+
go test ./...
24+
25+
# TODO: Install dependencies before running this target
26+
.PHONY: consul-proto
27+
consul-proto:
28+
buf generate "https://github.com/hashicorp/consul.git#branch=main,subdir=proto-public"
29+
30+
.PHONY: docker-build
31+
docker-build:
32+
docker build --no-cache . -t consul-dataplane

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Consul Dataplane
2+
3+
## Development
4+
5+
### Testing
6+
7+
#### Unit Tests
8+
9+
`make unit-tests`
10+
11+
### Generate Go code from Consul proto
12+
13+
`make consul-proto`

internal/consul-proto/pbacl/acl.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/consul-proto/pbconnectca/ca.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/consul-proto/pbdataplane/dataplane.pb.go

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/consul-proto/pbserverdiscovery/serverdiscovery.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)