Skip to content

Commit 9bda33e

Browse files
speedo17Speedo17thejoeejoeeCopilot
authored
chore(dev): add Dockerfile.jailoc for in-container development (#77)
* chore(gitignore): add .envrc * chore(dev): add Dockerfile.jailoc for in-container development * dev(dockerfile): keep 1.26.1 Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore(dev): move Dockerfile.jailoc to dev/ and fix docs --------- Co-authored-by: Speedo17 <jan.trnka@firma.seznam.cz> Co-authored-by: Josef Kolář <thejoeejoee@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e403eb6 commit 9bda33e

3 files changed

Lines changed: 72 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ Two services per workspace on a shared Docker network:
8888
- `t.Setenv()` is incompatible with `t.Parallel()` — tests using `t.Setenv` must NOT be parallel
8989
- `httptest.NewServer` in parallel subtests: use `t.Cleanup(ts.Close)`, NOT `defer ts.Close()` (defer runs before parallel subtests start)
9090

91+
## Development environment
92+
93+
`dev/Dockerfile.jailoc` is a workspace overlay for developing jailoc
94+
inside a jailoc container. It extends the base image with the Go toolchain, gopls,
95+
and golangci-lint matching CI.
96+
97+
Add to `~/.config/jailoc/config.toml`:
98+
99+
```toml
100+
[workspaces.jailoc]
101+
paths = ["/path/to/jailoc"]
102+
dockerfile = "https://raw.githubusercontent.com/seznam/jailoc/main/dev/Dockerfile.jailoc"
103+
```
104+
105+
`jailoc up jailoc` starts a container with Go, gopls, and golangci-lint on PATH.
106+
Run `go build`, `go test ./...`, and `golangci-lint run` inside as usual.
107+
91108
## CI/CD
92109

93110
GitHub Actions workflows:

dev/Dockerfile.jailoc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Workspace overlay image for developing jailoc inside a jailoc container.
2+
# Extends the jailoc base image with the Go toolchain, gopls, and golangci-lint.
3+
#
4+
# Usage — add to ~/.config/jailoc/config.toml:
5+
#
6+
# [workspaces.jailoc]
7+
# paths = ["/path/to/jailoc"]
8+
# dockerfile = "https://raw.githubusercontent.com/seznam/jailoc/main/dev/Dockerfile.jailoc"
9+
#
10+
# jailoc injects the resolved base image via the BASE build arg.
11+
12+
ARG BASE
13+
FROM ${BASE}
14+
15+
# Go toolchain — required by golangci-lint and gopls at runtime.
16+
# renovate: datasource=golang-version depName=go
17+
ARG GO_VERSION=1.26.1
18+
RUN set -eux; \
19+
ARCH=$(dpkg --print-architecture); \
20+
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${ARCH}.tar.gz" \
21+
| tar -xzC /usr/local
22+
ENV PATH="/usr/local/go/bin:${PATH}"
23+
24+
# gopls — Go language server for OpenCode code intelligence (go-to-definition, completions, diagnostics).
25+
# renovate: datasource=go depName=golang.org/x/tools/gopls
26+
ARG GOPLS_VERSION=v0.21.1
27+
RUN GOBIN=/usr/local/bin go install golang.org/x/tools/gopls@${GOPLS_VERSION}
28+
29+
# golangci-lint — static analysis matching CI (gosec, staticcheck, gocritic).
30+
# renovate: datasource=github-releases depName=golangci/golangci-lint
31+
ARG GOLANGCI_LINT_VERSION=v2.10.1
32+
RUN set -eux; \
33+
ARCH=$(dpkg --print-architecture); \
34+
curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION#v}-linux-${ARCH}.tar.gz" \
35+
| tar -xzC /usr/local/bin --strip-components=1 \
36+
"golangci-lint-${GOLANGCI_LINT_VERSION#v}-linux-${ARCH}/golangci-lint"

docs/development.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ The embedded Dockerfile defines an Ubuntu 24.04 base image. Exact versions are p
4141

4242
| Category | Tools |
4343
|----------|-------|
44-
| Runtimes | Go, Node.js, Bun, Python 3 + uv |
45-
| Package managers | npm, Yarn (via corepack), Homebrew |
46-
| Language servers | gopls, typescript-language-server, pyright, yaml-language-server, bash-language-server, jsonnet-language-server, helm-ls |
47-
| CLI tools | Docker CLI, ripgrep, fd, fzf, jq, vim, git, openssh-client |
48-
| Agent stack | OpenCode, oh-my-openagent |
44+
| Runtimes | Node.js, Python 3 |
45+
| Package managers | npm |
46+
| Language servers | typescript-language-server, pyright, yaml-language-server, bash-language-server |
47+
| CLI tools | ripgrep, fd, jq, git, openssh-client, curl |
48+
| Agent stack | OpenCode |
4949

5050
Source: [`internal/embed/assets/Dockerfile`](https://github.com/seznam/jailoc/blob/master/internal/embed/assets/Dockerfile)
5151

@@ -86,3 +86,17 @@ One file per package concern: `docker.go`, `compose.go`, `workspace.go`, `config
8686
### Testing
8787

8888
Unit tests live beside their source files as `*_test.go`. Integration tests live in `internal/integration_test.go` and require the `//go:build integration` build tag. Tests use `t.Parallel()` and a table-driven style with `t.Run`. There are no mocks, fixtures, or testdata directories.
89+
90+
## Developing inside a jailoc container
91+
92+
`dev/Dockerfile.jailoc` is a workspace overlay that extends the default image with the Go toolchain, gopls, and golangci-lint. It lets you develop jailoc inside a jailoc container.
93+
94+
Add to `~/.config/jailoc/config.toml`:
95+
96+
```toml
97+
[workspaces.jailoc]
98+
paths = ["/path/to/jailoc"]
99+
dockerfile = "https://raw.githubusercontent.com/seznam/jailoc/main/dev/Dockerfile.jailoc"
100+
```
101+
102+
Then run `jailoc up jailoc`. The standard build and test commands work inside the container unchanged.

0 commit comments

Comments
 (0)