From a1793c17abb8eddabe232534ee2d9dc6e6d0cfb9 Mon Sep 17 00:00:00 2001 From: Pijus Kamandulis Date: Sat, 25 Jan 2025 20:20:55 +0200 Subject: [PATCH] Added docker image with explorer included --- .goreleaser.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- Explorer.Dockerfile | 9 +++++++++ README.md | 9 ++++++++- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Explorer.Dockerfile diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 5d47cab..0b14310 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -66,6 +66,41 @@ dockers: - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" + - id: docker-explorer-linux-amd64 + goos: linux + goarch: amd64 + image_templates: + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-amd64" + dockerfile: Dockerfile + use: buildx + build_flag_templates: + - "--platform=linux/amd64" + - "--pull" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.description=Lightweight Cosmos DB emulator" + - "--label=org.opencontainers.image.url=https://github.com/pikami/cosmium" + - "--label=org.opencontainers.image.source=https://github.com/pikami/cosmium" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - id: docker-explorer-linux-arm64 + goos: linux + goarch: arm64 + image_templates: + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64" + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64v8" + dockerfile: Dockerfile + use: buildx + build_flag_templates: + - "--platform=linux/arm64" + - "--pull" + - "--label=org.opencontainers.image.title={{.ProjectName}}" + - "--label=org.opencontainers.image.description=Lightweight Cosmos DB emulator" + - "--label=org.opencontainers.image.url=https://github.com/pikami/cosmium" + - "--label=org.opencontainers.image.source=https://github.com/pikami/cosmium" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" docker_manifests: - name_template: 'ghcr.io/pikami/{{ .ProjectName }}:latest' @@ -78,6 +113,11 @@ docker_manifests: - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-amd64" - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-arm64" - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-arm64v8" + - name_template: 'ghcr.io/pikami/{{ .ProjectName }}:explorer' + image_templates: + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-amd64" + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64" + - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64v8" checksum: name_template: 'checksums.txt' diff --git a/Dockerfile b/Dockerfile index 0e459ce..c2ee176 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM scratch +FROM alpine:latest WORKDIR /app COPY cosmium /app/cosmium diff --git a/Explorer.Dockerfile b/Explorer.Dockerfile new file mode 100644 index 0000000..0fac08f --- /dev/null +++ b/Explorer.Dockerfile @@ -0,0 +1,9 @@ +FROM ghcr.io/cosmiumdev/cosmos-explorer-base:latest AS explorer-base +FROM alpine:latest + +COPY --from=explorer-base /cosmos-explorer /cosmos-explorer + +WORKDIR /app +COPY cosmium /app/cosmium + +ENTRYPOINT ["/app/cosmium", "-ExplorerDir", "/cosmos-explorer"] diff --git a/README.md b/README.md index b8b1caf..a7946e4 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,17 @@ AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJI If you want to run Cosmos DB Explorer alongside Cosmium, you'll need to build it yourself and point the `-ExplorerDir` argument to the dist directory. Please refer to the [Cosmos DB Explorer repository](https://github.com/Azure/cosmos-explorer) for instructions on building the application. +There's also a prebuilt docker image that includes the explorer: `ghcr.io/pikami/cosmium:explorer` + Once running, the explorer can be reached by navigating following URL: `https://127.0.0.1:8081/_explorer/` (might be different depending on your configuration). ### Running with docker (optional) +There are two docker tags available: + +- ghcr.io/pikami/cosmium:latest - Cosmium core service +- ghcr.io/pikami/cosmium:explorer - Cosmium with database explorer available on `https://127.0.0.1:8081/_explorer/` + If you wan to run the application using docker, configure it using environment variables see example: ```sh @@ -61,7 +68,7 @@ docker run --rm \ -e COSMIUM_PERSIST=/save.json \ -v ./save.json:/save.json \ -p 8081:8081 \ - ghcr.io/pikami/cosmium + ghcr.io/pikami/cosmium # or `ghcr.io/pikami/cosmium:explorer` ``` ### SSL Certificate