Skip to content
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

Base Dockerfiles for tfio #1089

Merged
merged 2 commits into from
Aug 17, 2020
Merged
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ $ TFIO_DATAPATH=bazel-bin python3

#### Docker

For Python development, a reference Dockerfile [here](tools/dev/Dockerfile) can be
For Python development, a reference Dockerfile [here](tools/docker/devel.Dockerfile) can be
used to build the TensorFlow I/O package (`tensorflow-io`) from source:
```sh
# Build and run the Docker image
$ docker build -f tools/dev/Dockerfile -t tfio-dev .
$ docker build -f tools/docker/devel.Dockerfile -t tfio-dev .
$ docker run -it --rm --net=host -v ${PWD}:/v -w /v tfio-dev

# Inside the docker container, ./configure.sh will install TensorFlow or use existing install
Expand Down
29 changes: 29 additions & 0 deletions tools/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Tensorflow-IO Dockerfiles

This directory maintains the Dockerfiles needed to build the tensorflow-io images.

## Building

To build a `tensorflow-io` image with CPU support:

```bash
$ docker build -f ./cpu.Dockerfile -t tfio-cpu .
```

**NOTE:** Each `.Dockerfile` has its own set of available `--build-arg`s which are documented
in the file itself.

## Running Locally Built Images

**Note for new Docker users:** the `-v` and `-u` flags share directories and
permissions between the Docker container and your machine. Without `-v`, your
work will be wiped once the container quits, and without `-u`, files created by
the container will have the wrong file permissions on your host machine. Check
out the
[Docker run documentation](https://docs.docker.com/engine/reference/run/) for
more info.

```sh
# Mount $PWD into the container and make it as the current working directory.
$ docker run -it --rm -v ${PWD}:/v -w /v tfio-cpu
```
25 changes: 25 additions & 0 deletions tools/docker/cpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed 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.
# ==============================================================================

# Python version for the base image
ARG PYTHON_VERSION=3.7-slim

FROM python:${PYTHON_VERSION}

# tfio package name and version for pip install
ARG TFIO_PACKAGE=tensorflow-io
ARG TFIO_PACKAGE_VERSION=

RUN pip install ${TFIO_PACKAGE}${TFIO_PACKAGE_VERSION:+==${TFIO_PACKAGE_VERSION}}
File renamed without changes.