Skip to content

Commit

Permalink
Upgrade to podman 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mgoltzsche committed May 2, 2021
1 parent c8937e7 commit ed30366
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 33 deletions.
51 changes: 26 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# runc
FROM golang:1.14-alpine3.12 AS runc
ARG RUNC_VERSION=v1.0.0-rc92
FROM golang:1.16-alpine3.13 AS runc
ARG RUNC_VERSION=v1.0.0-rc93
RUN set -eux; \
apk add --no-cache --virtual .build-deps gcc musl-dev libseccomp-dev make git bash; \
git clone --branch ${RUNC_VERSION} https://github.com/opencontainers/runc src/github.com/opencontainers/runc; \
apk add --no-cache --virtual .build-deps gcc musl-dev libseccomp-dev libseccomp-static make git bash; \
git clone -c 'advice.detachedHead=false' --branch ${RUNC_VERSION} https://github.com/opencontainers/runc src/github.com/opencontainers/runc; \
cd src/github.com/opencontainers/runc; \
make static BUILDTAGS='seccomp selinux ambient'; \
mv runc /usr/local/bin/runc; \
Expand All @@ -13,20 +13,21 @@ RUN set -eux; \


# podman build base
FROM golang:1.14-alpine3.12 AS podmanbuildbase
FROM golang:1.16-alpine3.13 AS podmanbuildbase
RUN apk add --update --no-cache git make gcc pkgconf musl-dev \
btrfs-progs btrfs-progs-dev libassuan-dev lvm2-dev device-mapper \
glib-static libc-dev gpgme-dev protobuf-dev protobuf-c-dev \
libseccomp-dev libselinux-dev ostree-dev openssl iptables bash \
go-md2man
RUN git clone https://github.com/bats-core/bats-core.git && cd bats-core && ./install.sh /usr/local
libseccomp-dev libseccomp-static libselinux-dev ostree-dev openssl iptables \
bash go-md2man
ARG BATS_VERSION=v1.3.0
RUN git clone -c 'advice.detachedHead=false' --branch ${BATS_VERSION} https://github.com/bats-core/bats-core.git && cd bats-core && ./install.sh /usr/local


# podman (without systemd support)
FROM podmanbuildbase AS podman
RUN apk add --update --no-cache tzdata curl
ARG PODMAN_VERSION=v3.0.1
RUN git clone --branch ${PODMAN_VERSION} https://github.com/containers/podman src/github.com/containers/podman
ARG PODMAN_VERSION=v3.1.2
RUN git clone -c 'advice.detachedHead=false' --branch ${PODMAN_VERSION} https://github.com/containers/podman src/github.com/containers/podman
WORKDIR $GOPATH/src/github.com/containers/podman
RUN make install.tools
RUN set -ex; \
Expand All @@ -39,8 +40,8 @@ RUN set -ex; \
# conmon (without systemd support)
FROM podmanbuildbase AS conmon
# conmon 2.0.19 cannot be built currently since alpine does not provide nix package yet
ARG CONMON_VERSION=v2.0.22
RUN git clone --branch ${CONMON_VERSION} https://github.com/containers/conmon.git /conmon
ARG CONMON_VERSION=v2.0.27
RUN git clone -c 'advice.detachedHead=false' --branch ${CONMON_VERSION} https://github.com/containers/conmon.git /conmon
WORKDIR /conmon
RUN set -ex; \
make git-vars bin/conmon PKG_CONFIG='pkg-config --static' CFLAGS='-std=c99 -Os -Wall -Wextra -Werror -static' LDFLAGS='-s -w -static'; \
Expand All @@ -49,8 +50,8 @@ RUN set -ex; \

# CNI plugins
FROM podmanbuildbase AS cniplugins
ARG CNI_PLUGIN_VERSION=v0.9.0
RUN git clone --branch=${CNI_PLUGIN_VERSION} https://github.com/containernetworking/plugins /go/src/github.com/containernetworking/plugins
ARG CNI_PLUGIN_VERSION=v0.9.1
RUN git clone -c 'advice.detachedHead=false' --branch=${CNI_PLUGIN_VERSION} https://github.com/containernetworking/plugins /go/src/github.com/containernetworking/plugins
WORKDIR /go/src/github.com/containernetworking/plugins
RUN set -ex; \
for PLUGINDIR in plugins/ipam/host-local plugins/main/loopback plugins/main/bridge plugins/meta/portmap; do \
Expand All @@ -66,15 +67,15 @@ WORKDIR /
RUN apk add --update --no-cache autoconf automake meson ninja linux-headers libcap-static libcap-dev
# Build libslirp
ARG LIBSLIRP_VERSION=v4.4.0
RUN git clone --branch=${LIBSLIRP_VERSION} https://gitlab.freedesktop.org/slirp/libslirp.git
RUN git clone -c 'advice.detachedHead=false' --branch=${LIBSLIRP_VERSION} https://gitlab.freedesktop.org/slirp/libslirp.git
WORKDIR /libslirp
RUN set -ex; \
LDFLAGS="-s -w -static" meson --prefix /usr -D default_library=static build; \
ninja -C build install
# Build slirp4netns
WORKDIR /
ARG SLIRP4NETNS_VERSION=v1.1.8
RUN git clone --branch $SLIRP4NETNS_VERSION https://github.com/rootless-containers/slirp4netns.git
ARG SLIRP4NETNS_VERSION=v1.1.9
RUN git clone -c 'advice.detachedHead=false' --branch $SLIRP4NETNS_VERSION https://github.com/rootless-containers/slirp4netns.git
WORKDIR /slirp4netns
RUN set -ex; \
./autogen.sh; \
Expand All @@ -85,8 +86,8 @@ RUN set -ex; \
# fuse-overlayfs (derived from https://github.com/containers/fuse-overlayfs/blob/master/Dockerfile.static)
FROM podmanbuildbase AS fuse-overlayfs
RUN apk add --update --no-cache autoconf automake meson ninja clang g++ eudev-dev fuse3-dev
ARG LIBFUSE_VERSION=fuse-3.10.1
RUN git clone --branch=$LIBFUSE_VERSION https://github.com/libfuse/libfuse /libfuse
ARG LIBFUSE_VERSION=fuse-3.10.3
RUN git clone -c 'advice.detachedHead=false' --branch=$LIBFUSE_VERSION https://github.com/libfuse/libfuse /libfuse
WORKDIR /libfuse
RUN set -ex; \
mkdir build; \
Expand All @@ -96,8 +97,8 @@ RUN set -ex; \
touch /dev/fuse; \
ninja install; \
fusermount3 -V
ARG FUSEOVERLAYFS_VERSION=v1.3.0
RUN git clone --branch=$FUSEOVERLAYFS_VERSION https://github.com/containers/fuse-overlayfs /fuse-overlayfs
ARG FUSEOVERLAYFS_VERSION=v1.5.0
RUN git clone -c 'advice.detachedHead=false' --branch=$FUSEOVERLAYFS_VERSION https://github.com/containers/fuse-overlayfs /fuse-overlayfs
WORKDIR /fuse-overlayfs
RUN set -ex; \
sh autogen.sh; \
Expand All @@ -108,11 +109,11 @@ RUN set -ex; \


# Download gpg
FROM alpine:3.12 AS gpg
FROM alpine:3.13 AS gpg
RUN apk add --no-cache gnupg

# Build podman base image
FROM alpine:3.12 AS podmanbase
FROM alpine:3.13 AS podmanbase
LABEL maintainer="Max Goltzsche <[email protected]>"
RUN apk add --no-cache tzdata ca-certificates
COPY --from=conmon /conmon/bin/conmon /usr/libexec/podman/conmon
Expand All @@ -125,7 +126,7 @@ RUN set -ex; \
ln -s /usr/local/bin/podman /usr/bin/docker; \
mkdir -p /podman/.local/share/containers/storage /var/lib/containers/storage; \
chown -R podman:podman /podman; \
mkdir -m1777 /.local /.config; \
mkdir -m1777 /.local /.config /.cache; \
podman --help >/dev/null; \
/usr/libexec/podman/conmon --help >/dev/null
ENV _CONTAINERS_USERNS_CONFIGURED=""
Expand All @@ -143,7 +144,7 @@ COPY --from=runc /usr/local/bin/runc /usr/local/bin/runc

# Download crun
FROM gpg AS crun
ARG CRUN_VERSION=0.18
ARG CRUN_VERSION=0.19.1
RUN set -ex; \
wget -O /usr/local/bin/crun https://github.com/containers/crun/releases/download/$CRUN_VERSION/crun-${CRUN_VERSION}-linux-amd64-disable-systemd; \
wget -O /tmp/crun.asc https://github.com/containers/crun/releases/download/$CRUN_VERSION/crun-${CRUN_VERSION}-linux-amd64-disable-systemd.asc; \
Expand Down
15 changes: 8 additions & 7 deletions Dockerfile-remote
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# podman build base
FROM golang:1.14-alpine3.12 AS podmanbuildbase
FROM golang:1.16-alpine3.13 AS podmanbuildbase
RUN apk add --update --no-cache git make gcc pkgconf musl-dev \
btrfs-progs btrfs-progs-dev libassuan-dev lvm2-dev device-mapper \
glib-static libc-dev gpgme-dev protobuf-dev protobuf-c-dev \
libseccomp-dev libselinux-dev ostree-dev openssl iptables bash \
go-md2man
RUN git clone https://github.com/bats-core/bats-core.git && cd bats-core && ./install.sh /usr/local
libseccomp-dev libseccomp-static libselinux-dev ostree-dev openssl iptables \
bash go-md2man
ARG BATS_VERSION=v1.3.0
RUN git clone -c 'advice.detachedHead=false' --branch ${BATS_VERSION} https://github.com/bats-core/bats-core.git && cd bats-core && ./install.sh /usr/local

# podman remote
FROM podmanbuildbase AS podman-remote
RUN apk add --update --no-cache curl
ARG PODMAN_VERSION=v3.0.1
RUN git clone --branch ${PODMAN_VERSION} https://github.com/containers/podman src/github.com/containers/podman
ARG PODMAN_VERSION=v3.1.2
RUN git clone -c 'advice.detachedHead=false' --branch ${PODMAN_VERSION} https://github.com/containers/podman src/github.com/containers/podman
WORKDIR $GOPATH/src/github.com/containers/podman
RUN make install.tools
RUN set -eux; \
Expand All @@ -22,6 +23,6 @@ RUN set -eux; \
podman --help >/dev/null; \
[ "$(ldd /usr/local/bin/podman-remote | wc -l)" -eq 0 ] || (ldd /usr/local/bin/podman-remote; false)

FROM alpine:3.12
FROM alpine:3.13
COPY --from=podman-remote /usr/local/bin /usr/local/bin
RUN adduser -D podman-remote -h /podman -u 1000
4 changes: 3 additions & 1 deletion test/test-remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set -ux

ADDRESS=127.0.0.1:53453

mkdir -pm1777 `pwd`/storage/user
PODMAN_CONTAINER="$($DOCKER run -d --rm --privileged --network=host -u podman:podman \
-v "`pwd`/storage/user":/podman/.local/share/containers/storage \
"${PODMAN_IMAGE}" \
Expand All @@ -28,11 +29,12 @@ $DOCKER run --rm --network=host -v "$(pwd):/build" \

# ATTENTION: podman remote fails if it cannot map the uids/gids from the server locally as well (which is why podman-remote user has been added)
$DOCKER run --rm --network=host --user=podman-remote:podman-remote \
-v "`pwd`:/build" \
-v "`pwd`/Dockerfile:/build/Dockerfile" \
"${PODMAN_REMOTE_IMAGE}" \
sh -c "set -ex; \
podman --log-level=debug --remote --url=tcp://$ADDRESS build -t testbuild -f /build/Dockerfile /build; \
podman --url=tcp://$ADDRESS run testbuild echo hello from remote container"

# ATTENTION: volume mounts don't work (using podman 2.0.4)
#$DOCKER run --rm --network=host \
# -v "`pwd`:/build" \
Expand Down

0 comments on commit ed30366

Please sign in to comment.