Skip to content

Dockerfiles enhanced to support ARM64 #7937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/dashboard/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN find . -type f \( -name '*.html' -o -name '*.js' -o -name '*.css' -o -name '

COPY components-gitpod-protocol--gitpod-schema/gitpod-schema.json /www/static/schemas/gitpod-schema.json

FROM caddy/caddy:2.4.0-alpine
FROM caddy:2.4.0-alpine

COPY components-dashboard--static/conf/Caddyfile /etc/caddy/Caddyfile
COPY --from=compress /www /www
Expand Down
8 changes: 5 additions & 3 deletions components/docker-up/dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
set -euo pipefail

DOCKER_VERSION=19.03.15
DOCKER_COMPOSE_VERSION=1.29.2
DOCKER_COMPOSE_VERSION=2.2.3
SLIRP4NETNS_VERSION=v1.1.12

curl -o docker.tgz -fsSL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz
curl -o docker-compose -fsSL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64
curl -o docker.tgz -fsSL https://download.docker.com/linux/static/stable/$(uname -m)/docker-${DOCKER_VERSION}.tgz
curl -o docker-compose -fsSL https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-$(uname -m)
curl -o slirp4netns -fsSL https://github.com/rootless-containers/slirp4netns/releases/download/${SLIRP4NETNS_VERSION}/slirp4netns-$(uname -m)
2 changes: 1 addition & 1 deletion components/gitpod-db/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /app
RUN /installer/install.sh

FROM node:16.13.0 as proxy
RUN wget https://storage.googleapis.com/cloudsql-proxy/v1.23.0/cloud_sql_proxy.linux.amd64 -O /bin/cloud_sql_proxy \
RUN wget https://storage.googleapis.com/cloudsql-proxy/v1.23.0/cloud_sql_proxy.linux.$(dpkg --print-architecture) -O /bin/cloud_sql_proxy \
&& chmod +x /bin/cloud_sql_proxy

FROM node:16.13.0-slim
Expand Down
2 changes: 1 addition & 1 deletion components/ide-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN for FILE in `ls /bin/gitpod-local-companion*`;do \
done


FROM caddy/caddy:2.4.6-alpine
FROM caddy:2.4.6-alpine

COPY conf/Caddyfile /etc/caddy/Caddyfile
COPY static /www/
Expand Down
27 changes: 21 additions & 6 deletions components/ide/code/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# Licensed under the GNU Affero General Public License (AGPL).
# See License-AGPL.txt in the project root for license information.

FROM gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64 as dependencies_builder
FROM gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8 as dependencies_builder
# BUILDER_BASE is a placeholder, will be replaced before build time
# Check BUILD.yaml
FROM BUILDER_BASE as code_installer

ARG CODE_COMMIT

Expand All @@ -16,7 +19,7 @@ WORKDIR /gp-code
RUN yarn --cwd remote --frozen-lockfile --network-timeout 180000


FROM gitpod/openvscode-server-linux-build-agent:bionic-x64 as code_installer
FROM gitpod/openvscode-server-linux-build-agent:bionic as code_installer

USER root

Expand Down Expand Up @@ -44,8 +47,20 @@ RUN yarn --frozen-lockfile --network-timeout 180000 \
&& yarn --cwd remote/web --frozen-lockfile --network-timeout 180000 \
&& yarn --cwd extensions compile \
&& yarn gulp vscode-web-min \
&& yarn gulp vscode-reh-linux-x64-min
COPY --from=dependencies_builder /gp-code/remote/node_modules/ /vscode-reh-linux-x64/node_modules/
RUN arch="$(uname -m)"; \
case "$arch" in \
'x86_64') \
yarn gulp vscode-reh-linux-x64-min \
&& mv /vscode-reh-linux-x64 /vscode-reh-linux \
;; \
'aarch64') \
yarn gulp vscode-reh-linux-arm64-min \
&& mv /vscode-reh-linux-arm64 /vscode-reh-linux \
;; \
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
esac;
&& yarn gulp vscode-web-min \
COPY --from=dependencies_builder /gp-code/remote/node_modules/ /vscode-reh-linux/node_modules/

# config for first layer needed by blobserve
# we also remove `static/` from resource urls as that's needed by blobserve,
Expand All @@ -60,12 +75,12 @@ COPY bin /ide/bin
RUN chmod -R ugo+x /ide/bin

# grant write permissions for built-in extensions
RUN chmod -R ugo+w /vscode-reh-linux-x64/extensions
RUN chmod -R ugo+w /vscode-reh-linux/extensions

FROM scratch
# copy static web resources in first layer to serve from blobserve
COPY --from=code_installer --chown=33333:33333 /vscode-web/ /ide/
COPY --from=code_installer --chown=33333:33333 /vscode-reh-linux-x64/ /ide/
COPY --from=code_installer --chown=33333:33333 /vscode-reh-linux/ /ide/
COPY --chown=33333:33333 startup.sh supervisor-ide-config.json /ide/

COPY --from=code_installer --chown=33333:33333 /ide/bin /ide/bin/remote-cli
Expand Down
2 changes: 2 additions & 0 deletions components/image-builder-bob/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"syscall"
"time"

Expand Down Expand Up @@ -146,6 +147,7 @@ func buildImage(ctx context.Context, contextDir, dockerfile, authLayer, target s
"--frontend=dockerfile.v0",
"--local=dockerfile=" + filepath.Dir(dockerfile),
"--opt=filename=" + filepath.Base(dockerfile),
"--opt=platform=" + fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),
}

buildctlCmd := exec.Command("buildctl", buildctlArgs...)
Expand Down
5 changes: 3 additions & 2 deletions components/image-builder-mk3/pkg/resolve/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"runtime"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -137,13 +138,13 @@ func (sr *StandaloneRefResolver) Resolve(ctx context.Context, ref string, opts .

var dgst digest.Digest
for _, mf := range mfl.Manifests {
if fmt.Sprintf("%s-%s", mf.Platform.OS, mf.Platform.Architecture) == "linux-amd64" {
if fmt.Sprintf("%s-%s", mf.Platform.OS, mf.Platform.Architecture) == fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH) {
dgst = mf.Digest
break
}
}
if dgst == "" {
return "", fmt.Errorf("no manifest for platform linux-amd64 found")
return "", fmt.Errorf("no manifest for platform %s found", fmt.Sprintf("%s-%s", runtime.GOOS, runtime.GOARCH))
}

pref, err = reference.WithDigest(pref, dgst)
Expand Down
2 changes: 1 addition & 1 deletion components/proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

FROM golang:1.17 as builder

RUN curl -fsSL https://github.com/caddyserver/xcaddy/releases/download/v0.2.0/xcaddy_0.2.0_linux_amd64.tar.gz \
RUN curl -fsSL https://github.com/caddyserver/xcaddy/releases/download/v0.2.0/xcaddy_0.2.0_linux_$(dpkg --print-architecture).tar.gz \
| tar -xzv -C /usr/local/bin/ xcaddy

WORKDIR /plugins
Expand Down
2 changes: 1 addition & 1 deletion components/workspacekit/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ packages:
type: generic
config:
commands:
- ["sh", "-c", "curl -o fuse-overlayfs -L https://github.com/containers/fuse-overlayfs/releases/download/v1.7.1/fuse-overlayfs-x86_64 && chmod +x fuse-overlayfs"]
- ["sh", "-c", "curl -o fuse-overlayfs -L https://github.com/containers/fuse-overlayfs/releases/download/v1.7.1/fuse-overlayfs-$(uname -m) && chmod +x fuse-overlayfs"]
- name: lib
type: go
srcs:
Expand Down
2 changes: 1 addition & 1 deletion components/workspacekit/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
FROM alpine:3.15 as download
ENV SLIRP4NETNS_VERSION=v1.1.12
WORKDIR /download
RUN wget https://github.com/rootless-containers/slirp4netns/releases/download/${SLIRP4NETNS_VERSION}/slirp4netns-x86_64 -O slirp4netns && chmod 755 slirp4netns
RUN wget https://github.com/rootless-containers/slirp4netns/releases/download/${SLIRP4NETNS_VERSION}/slirp4netns-$(uname -m) -O slirp4netns && chmod 755 slirp4netns

FROM scratch

Expand Down
18 changes: 14 additions & 4 deletions components/ws-daemon/leeway.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@

FROM alpine:3.15 as dl
WORKDIR /dl
RUN apk add --no-cache curl \
&& curl -OL https://github.com/opencontainers/runc/releases/download/v1.0.1/runc.amd64 \
&& chmod +x runc.amd64
RUN arch="$(uname -m)"; \
case "$arch" in \
'x86_64') \
export ARCH='amd64' \
;; \
'aarch64') \
export ARCH='arm64' \
;; \
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
esac; \
apk add --no-cache curl \
&& curl -o runc -L https://github.com/opencontainers/runc/releases/download/v1.1.0/runc.${ARCH} \
&& chmod +x runc

FROM alpine:3.15

Expand All @@ -18,7 +28,7 @@ RUN apk add --no-cache git bash openssh-client lz4 e2fsprogs coreutils tar strac

RUN apk add --no-cache kubectl --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

COPY --from=dl /dl/runc.amd64 /usr/bin/runc
COPY --from=dl /dl/runc /usr/bin/runc

# Add gitpod user for operations (e.g. checkout because of the post-checkout hook!)
RUN addgroup -g 33333 gitpod \
Expand Down
5 changes: 2 additions & 3 deletions contrib/docker/examples/gitpod-gitlab/gitlab/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

FROM rancher/k3s:v1.21.2-k3s1

ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static /tini
RUN chmod +x /tini
RUN apk add --no-cache tini

VOLUME /var/gitlab/gitaly
VOLUME /var/gitlab/minio
Expand All @@ -18,4 +17,4 @@ COPY persistent-volumes.yaml /var/lib/rancher/k3s/server/manifests/

COPY entrypoint.sh /entrypoint

ENTRYPOINT [ "/tini", "-g", "--", "/entrypoint" ]
ENTRYPOINT [ "/sbin/tini", "-g", "--", "/entrypoint" ]
22 changes: 17 additions & 5 deletions contrib/docker/gitpod-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,23 @@

FROM rancher/k3s:v1.21.2-k3s1

ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static /tini
RUN chmod +x /tini
RUN apk add --no-cache tini

ADD https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_amd64 /bin/yq
RUN chmod +x /bin/yq
ADD https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_arm64 /bin/yq-arm64
RUN chmod +x /bin/yq-arm64
ADD https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_amd64 /bin/yq-amd64
RUN chmod +x /bin/yq-amd64

RUN arch="$(uname -m)"; \
case "$arch" in \
'x86_64') \
mv /bin/yq-amd64 /bin/yq \
;; \
'aarch64') \
mv /bin/yq-arm64 /bin/yq \
;; \
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
esac;

VOLUME /var/gitpod/docker
VOLUME /var/gitpod/docker-registry
Expand All @@ -22,4 +34,4 @@ COPY chart--helm/gitpod /chart

COPY entrypoint.sh /entrypoint

ENTRYPOINT [ "/tini", "-g", "--", "/entrypoint" ]
ENTRYPOINT [ "/sbin/tini", "-g", "--", "/entrypoint" ]