From d021552c73d33ce96307823a930533769c173fed Mon Sep 17 00:00:00 2001 From: Omar Ismail Date: Sun, 13 Sep 2020 16:28:06 -0400 Subject: [PATCH 1/3] [BEAM-10891] Dockerfile for development container --- Dockerfile | 58 +++++++++++++++++++ .../www/site/content/en/contribute/_index.md | 5 ++ 2 files changed, 63 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..8c59be028cbf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +############################################################################### +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +############################################################################### + +# Dockerfile for container with dev prerequisites + + +FROM ubuntu + +ARG DEBIAN_FRONTEND=noninteractive + +# Update and install common packages +RUN apt-get update && apt-get install -y software-properties-common apt-transport-https ca-certificates curl gnupg-agent software-properties-common git vim + +# Setup to install docker +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - +RUN apt-key fingerprint 0EBFCD88 +RUN add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + +# Repo for different Python versions +RUN add-apt-repository -y ppa:deadsnakes/ppa + + +# Install packages +RUN apt-get install -y openjdk-8-jdk python3-setuptools python3-pip python3.5 python3.6 python3.7 python2.7 virtualenv tox docker-ce docker-ce-cli containerd.io + + +# Install Go +RUN mkdir -p /goroot && curl https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1 + +# Set environment variables for Go +ENV GOROOT /goroot +ENV GOPATH /gopath +ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH +CMD go get github.com/linkedin/goavro + +# Install grpcio-tools mypy-protobuf for `python3 sdks/python/setup.py sdist` to work +RUN pip3 install grpcio-tools mypy-protobuf + +# Set work directory +WORKDIR /workspaces/beam diff --git a/website/www/site/content/en/contribute/_index.md b/website/www/site/content/en/contribute/_index.md index 417565bba1c3..e0f4390622c6 100644 --- a/website/www/site/content/en/contribute/_index.md +++ b/website/www/site/content/en/contribute/_index.md @@ -94,6 +94,11 @@ $ go get github.com/linkedin/goavro gLinux users should configure their machines for sudoless Docker. +Alternatively, you can use the [Dockerfile](https://github.com/apache/beam/blob/master/Dockerfile) to setup a container meeting the requirements above, and mounting the directory that contains the Beam repo to the container. e.g.: +```shell script +docker run -it --mount type=bind,source=/Users/jsmith/Desktop/beam,target=/workspaces/beam bash +``` + ### Connect With the Beam community 1. Consider subscribing to the [dev@ mailing list](/community/contact-us/), especially From 9f487315029fea84be79631a99bd39a2e8ab0dd5 Mon Sep 17 00:00:00 2001 From: omarismail94 Date: Mon, 23 Nov 2020 00:56:31 +0000 Subject: [PATCH 2/3] [BEAM-10891] Dockerfile for development container --- Dockerfile | 56 +++++++++++++------ .../www/site/content/en/contribute/_index.md | 2 +- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c59be028cbf..13babd8ddccb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,12 +19,32 @@ # Dockerfile for container with dev prerequisites -FROM ubuntu +FROM ubuntu:20.04 ARG DEBIAN_FRONTEND=noninteractive # Update and install common packages -RUN apt-get update && apt-get install -y software-properties-common apt-transport-https ca-certificates curl gnupg-agent software-properties-common git vim +RUN apt -q update \ + && apt install -y software-properties-common apt-utils apt-transport-https ca-certificates \ + && add-apt-repository -y ppa:deadsnakes/ppa \ + && apt-get -q install -y --no-install-recommends \ + curl \ + gnupg-agent \ + rsync \ + git \ + vim \ + locales \ + wget \ + time \ + openjdk-8-jdk \ + python3-setuptools \ + python3-pip \ + python3.5 \ + python3.6 \ + python3.7 \ + python2.7 \ + virtualenv \ + tox # Setup to install docker RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - @@ -33,26 +53,28 @@ RUN add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" +RUN apt-get install -y docker-ce docker-ce-cli containerd.io -# Repo for different Python versions -RUN add-apt-repository -y ppa:deadsnakes/ppa - - -# Install packages -RUN apt-get install -y openjdk-8-jdk python3-setuptools python3-pip python3.5 python3.6 python3.7 python2.7 virtualenv tox docker-ce docker-ce-cli containerd.io +# Set the locale +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +#Set Python3.6 as default +RUN alias python=python3.6 # Install Go -RUN mkdir -p /goroot && curl https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz | tar xvzf - -C /goroot --strip-components=1 +RUN wget https://golang.org/dl/go1.15.5.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz +# ENV PATH $PATH:/usr/local/go/bin +ENV GOROOT /usr/local/go +ENV PATH $PATH:$GOROOT/bin -# Set environment variables for Go -ENV GOROOT /goroot -ENV GOPATH /gopath -ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH -CMD go get github.com/linkedin/goavro +# Set work directory +WORKDIR /workspaces/beam +ENV GOPATH /workspaces/beam/sdks/go/examples/.gogradle/project_gopath +RUN go get github.com/linkedin/goavro # Install grpcio-tools mypy-protobuf for `python3 sdks/python/setup.py sdist` to work RUN pip3 install grpcio-tools mypy-protobuf - -# Set work directory -WORKDIR /workspaces/beam diff --git a/website/www/site/content/en/contribute/_index.md b/website/www/site/content/en/contribute/_index.md index e0f4390622c6..02e42d361c75 100644 --- a/website/www/site/content/en/contribute/_index.md +++ b/website/www/site/content/en/contribute/_index.md @@ -96,7 +96,7 @@ gLinux users should configure their machines for sudoless Docker. Alternatively, you can use the [Dockerfile](https://github.com/apache/beam/blob/master/Dockerfile) to setup a container meeting the requirements above, and mounting the directory that contains the Beam repo to the container. e.g.: ```shell script -docker run -it --mount type=bind,source=/Users/jsmith/Desktop/beam,target=/workspaces/beam bash +docker run -it --network=host -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source="$PWD",target=/workspaces/beam bash ``` ### Connect With the Beam community From 32dd1e0000f52ad833882bf35f9949776901bae9 Mon Sep 17 00:00:00 2001 From: omarismail94 Date: Mon, 23 Nov 2020 00:59:21 +0000 Subject: [PATCH 3/3] [BEAM-10891] Dockerfile for development container --- website/www/site/content/en/contribute/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/www/site/content/en/contribute/_index.md b/website/www/site/content/en/contribute/_index.md index 02e42d361c75..794f9deb7642 100644 --- a/website/www/site/content/en/contribute/_index.md +++ b/website/www/site/content/en/contribute/_index.md @@ -94,7 +94,7 @@ $ go get github.com/linkedin/goavro gLinux users should configure their machines for sudoless Docker. -Alternatively, you can use the [Dockerfile](https://github.com/apache/beam/blob/master/Dockerfile) to setup a container meeting the requirements above, and mounting the directory that contains the Beam repo to the container. e.g.: +Alternatively, you can use the [Dockerfile](https://github.com/apache/beam/blob/master/Dockerfile) to setup a container meeting the requirements above, and mount your clone of the Beam repo to the container. e.g.: ```shell script docker run -it --network=host -v /var/run/docker.sock:/var/run/docker.sock --mount type=bind,source="$PWD",target=/workspaces/beam bash ```