Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 188 local docker dev for make #189

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The purpose of this file is to simply run make commands in deterministic
# environment for those interested in contributing. This is not to be used
# for production purposes.
FROM ubuntu:22.04
Copy link
Contributor

@jbilskiAkam jbilskiAkam Jul 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why you used ubuntu? If not, could alpine golang be used?
Our proposed solution with alpine golang:

# The purpose of this file is to simply run make commands in deterministic
# environment for those interested in contributing. This is not to be used
# for production purposes.
FROM golang:alpine3.17

RUN apk add make git curl

COPY . /workdir

WORKDIR /workdir

# This is a workaround so that running `make lint` does not result in a
# "error obtaining VCS status: exit status 128" error
RUN go env -w GOFLAGS="-buildvcs=false"


RUN apt update && apt upgrade

RUN apt install -y wget make vim git curl golang-go

# This is a workaround so that running `make lint` does not result in a
# "error obtaining VCS status: exit status 128" error
RUN go env -w GOFLAGS="-buildvcs=false"
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ clean: ; $(info $(M) Removing 'bin' directory and test results...) @ ## Cleanup
clean-tools: ## Cleanup installed packages
@rm -rf $(BIN)/go*

.PHONY: dockerized
dockerized: ; $(info $(M) Running `make $(target)` in docker...) @
@echo "$(target)"
@if [ "$(target)" = "dockerized"]; then \
echo "Please do not hurt yourself.";\
exit 1;\
fi
@docker build -t local/akamai-cli-build .
@docker run --rm -v $(CURDIR):/go/src/github.com/akamai/cli -w /go/src/github.com/akamai/cli local/akamai-cli-build \
make "$(target)"

.PHONY: help
help: ## List all make targets
echo $(MAKEFILE_LIST)
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,28 @@ To compile Akamai CLI from source:

5. Move the `akamai` or `akamai.exe` binary so that it's available in your `$PATH`.

### Contributing to Akamai's CLI

**Prerequisite:** You must have `docker` installed.

To ensure consistency in how this project builds, use this [Dockerfile](./Dockerfile).

1. Write your code, and include tests.

1. Verify linting passes
```sh
$ make dockerized target=lint
```
1. Verify your tests pass
```sh
$ make dockerized target=test
```
1. Ensure that the project builds in its entirety.
```sh
$ make dockerized target=all
```
1. Submit your PR

### API credentials

Akamai-branded packages use a `.edgerc` file for standard EdgeGrid authentication. By default, CLI looks for credentials in your `$HOME` directory.
Expand Down