Skip to content

Commit

Permalink
refactor(docker): publish images under both names
Browse files Browse the repository at this point in the history
This ensures we keep publishing the same image under both names:

    $ ./bin/get-docker-tags.sh $(date -u +%F) 88d8815 master                                                                                                                                 ...chore/rename-to-banana
    ipfs/kubo:master-2022-06-21-88d8815
    ipfs/go-ipfs:master-2022-06-21-88d8815
    ipfs/kubo:master-latest
    ipfs/go-ipfs:master-latest
  • Loading branch information
lidel committed Jun 21, 2022
1 parent b352599 commit 6086a70
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ on:

jobs:
push_to_registry:
if: github.repository == 'ipfs/go-ipfs' || github.event_name == 'workflow_dispatch'
if: github.repository == 'ipfs/go-ipfs' || github.repository == 'ipfs/kubo' || github.event_name == 'workflow_dispatch'
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
env:
IMAGE_NAME: ipfs/go-ipfs
IMAGE_NAME: ipfs/kubo
LEGACY_IMAGE_NAME: ipfs/go-ipfs
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y \
ca-certificates \
fuse

ENV SRC_DIR /go-ipfs
ENV SRC_DIR /kubo

# Download packages first so they can be cached.
COPY go.mod go.sum $SRC_DIR/
Expand Down Expand Up @@ -51,7 +51,7 @@ FROM busybox:1.31.1-glibc
LABEL maintainer="Steven Allen <[email protected]>"

# Get the ipfs binary, entrypoint script, and TLS CAs from the build container.
ENV SRC_DIR /go-ipfs
ENV SRC_DIR /kubo
COPY --from=0 $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs
COPY --from=0 $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs
COPY --from=0 $SRC_DIR/bin/container_init_run /usr/local/bin/container_init_run
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ If your system is resource-constrained, we recommend:

### Docker

[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/ipfs/go-ipfs?color=blue&label=go-ipfs%20docker%20image&logo=docker&sort=semver&style=flat-square&cacheSeconds=3600)](https://hub.docker.com/r/ipfs/go-ipfs/)
[![Docker Image Version (legacy name)](https://img.shields.io/docker/v/ipfs/go-ipfs?color=blue&label=go-ipfs%20docker%20image&logo=docker&sort=semver&style=flat-square&cacheSeconds=3600)](https://hub.docker.com/r/ipfs/go-ipfs/)
<!-- TODO: replace with kubo after we have minimum set of images after kubo 0.14 (stable semver release, 'latest' and 'release' docker tags)
[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/ipfs/kubo?color=blue&label=kubo%20docker%20image&logo=docker&sort=semver&style=flat-square&cacheSeconds=3600)](https://hub.docker.com/r/ipfs/kubo/)
-->

More info on how to run kubo inside docker can be found [here](https://docs.ipfs.io/how-to/run-ipfs-inside-docker/).
More info on how to run kubo (go-ipfs) inside Docker can be found [here](https://docs.ipfs.io/how-to/run-ipfs-inside-docker/).

### Native Linux package managers

Expand Down
6 changes: 4 additions & 2 deletions bin/get-docker-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ BUILD_NUM=$1
GIT_SHA1=${2:-$(git rev-parse HEAD)}
GIT_SHA1_SHORT=$(echo "$GIT_SHA1" | cut -c 1-7)
GIT_BRANCH=${3:-$(git symbolic-ref -q --short HEAD || echo "unknown")}
GIT_TAG=${4:-$(git describe --tags --exact-match || echo "")}
GIT_TAG=${4:-$(git describe --tags --exact-match 2> /dev/null || echo "")}

IMAGE_NAME=${IMAGE_NAME:-ipfs/go-ipfs}
IMAGE_NAME=${IMAGE_NAME:-ipfs/kubo}
LEGACY_IMAGE_NAME=${LEGACY_IMAGE_NAME:-ipfs/go-ipfs}

echoImageName () {
local IMAGE_TAG=$1
echo "$IMAGE_NAME:$IMAGE_TAG"
echo "$LEGACY_IMAGE_NAME:$IMAGE_TAG"
}

if [[ $GIT_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
Expand Down

0 comments on commit 6086a70

Please sign in to comment.