Skip to content

Commit

Permalink
Drop Dockerfile.workspace (#173)
Browse files Browse the repository at this point in the history
None of our projects currently make use of this, and on upgrading the
image to `golang:1.23.4-alpine3.20`, we're seeing errors on the glibc
step in the Dockerfile. For now, remove it.
  • Loading branch information
stefanvanburen authored Jan 2, 2025
1 parent 82adaab commit f43a184
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 69 deletions.
36 changes: 0 additions & 36 deletions Dockerfile.workspace

This file was deleted.

15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ The following are controlled by makego, and should not be edited directly:
- [.gitignore](.gitignore) The autogenerated git ignore file.
- [go.mod](go.mod), [go.sum](go.sum) - The Golang module files. These are autogenerated.

Additionally, makego expects the following if Docker is used:

- [Dockerfile.workspace](Dockerfile.workspace) the Dockerfile for development of your Golang
repository. If you include [make/go/docker.mk](make/go/docker.mk), this file should be present.

Otherwise, you're free to choose your own layout, however you should generally do the following:

- Have a file `make/PROJECT/all.mk` such as [make/foo/all.mk](make/foo/all.mk) that defines the
Expand Down Expand Up @@ -164,16 +159,14 @@ We are not documenting all development commands, however some important ones of

- `make all` - This is the default goal, and runs linting and testing.
- `make ci` - This is the goal for CI, and downloads deps, and runs linting, testing, and code coverage.
Note that deps are downloaded automatically on a per-target basis, so the intial dep download really
Note that deps are downloaded automatically on a per-target basis, so the initial dep download really
shouldn't be needed.
- `make generate` - Do all generation.
- `make lint` - Do all linting.
- `make build` - Go build.
- `make test` - Go test.
- `make cover` - Go code coverage.
- `make install` - Install all Go binaries defined by `GO_BINS`.
- `make dockermakeworkspace` - This will run `make all` by default inside the Docker container
defined by `Docker.workspace`. You can edit the Makefile target with `DOCKERMAKETARGET`.
- `make dockerbuild` - Build all Docker images defined by `DOCKER_BINS`.
- `make updatemakego` - Update from makego main.

Expand Down Expand Up @@ -207,7 +200,7 @@ These variables are settable in your Makefiles, but should be static, i.e. these
project-specific settings and not intended to be set on the command line.

- `FILE_IGNORES` - The relative paths to files to add to `.dockerignore` and `.gitignore`. By
default, makego will add `.env`, `.tmp`. and any Golang binaries.
default, makego will add `.env`, `.tmp`, and any Golang binaries.
Note if you set this, you should do so by including the current value ie `FILE_IGNORES := $(FILE_IGNORES) .build/`.
- `CACHE_BASE` - By default, makego caches to `~/.cache/$(PROJECT)`. Set this to change that.
- `GO_BINS` - The relative paths to your Golang main packages, For example `cmd/foo`.
Expand All @@ -232,9 +225,7 @@ These variables are meant to be set when invoking make targets on the command li
against updating when not intended.
- `ALL` - This results in all makego files being downloaded when running `make updatemakego`
instead of just the ones that you current have included.
- `DOCKERMAKETARGET` - This changes the recursive make target for `make dockermakeworkspace` from
`all` to this value.
- `GOPKGS` - This controls what packages to build for Go commands. By default, this is `./...`. If
you only wanted to test `./internal/foo/...` for example, you could run `make test GOPKGS=./internal/foo/...`
- `COVEROPEN` - This will result in the `cover.html` file being automatically opened after `make
cover` is run, for example `make cover COVEROPEN=1.
cover` is run, for example `make cover COVEROPEN=1`.
21 changes: 0 additions & 21 deletions make/go/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,11 @@ $(call _assert_var,DOCKER_ORG)
# Must be set
$(call _assert_var,DOCKER_PROJECT)

DOCKER_WORKSPACE_IMAGE := $(DOCKER_ORG)/$(DOCKER_PROJECT)-workspace
DOCKER_WORKSPACE_FILE := Dockerfile.workspace
DOCKER_WORKSPACE_DIR := /workspace

# Settable
DOCKER_BINS ?=
# Settable
DOCKER_BUILD_EXTRA_FLAGS ?=

# Runtime
DOCKERMAKETARGET ?= all

.PHONY: dockerbuildworkspace
dockerbuildworkspace:
docker build \
$(DOCKER_BUILD_EXTRA_FLAGS) \
--build-arg PROJECT=$(PROJECT) \
--build-arg GO_MODULE=$(GO_MODULE) \
-t $(DOCKER_WORKSPACE_IMAGE) \
-f $(DOCKER_WORKSPACE_FILE) \
.

.PHONY: dockermakeworkspace
dockermakeworkspace: dockerbuildworkspace
docker run -v "$(CURDIR):$(DOCKER_WORKSPACE_DIR)" $(DOCKER_WORKSPACE_IMAGE) make -j 8 $(DOCKERMAKETARGET)

.PHONY: dockerbuild
dockerbuild::

Expand Down

0 comments on commit f43a184

Please sign in to comment.