Skip to content

Commit 8bc9920

Browse files
committed
Add Dockerfile for codegen distribution
1 parent 9805e27 commit 8bc9920

2 files changed

Lines changed: 38 additions & 20 deletions

File tree

DEPLOYING.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ How to Deploy GRPC Java to Maven Central (for Maintainers Only)
33

44
Build Environments
55
------------------
6-
We have succesfully deployed GRPC to Maven Central under the following systems:
7-
- Ubuntu 14.04 64-bit
6+
We deploy GRPC to Maven Central under the following systems:
7+
- Ubuntu 14.04 with Docker 1.6.1 that runs CentOS 6.6
88
- Windows 7 64-bit with MSYS2 with mingw32 and mingw64
99
- Mac OS X 10.9.5
1010

@@ -48,22 +48,12 @@ separately and install it under your personal directory, because
4848
system paths.
4949

5050

51-
#### Linux
52-
You must have multilib GCC installed on your system.
53-
54-
Compile and install 32-bit protobuf:
51+
#### Linux with Docker
52+
Build the ``protoc-artifacts`` image under the Protobuf source directory:
5553
```
56-
protobuf$ CXXFLAGS="-m32" ./configure --disable-shared --prefix=$HOME/protobuf-32
57-
protobuf$ make clean && make && make install
54+
protobuf$ docker build -t protoc-artifacts protoc-artifacts
5855
```
5956

60-
Compile and install 64-bit protobuf:
61-
```
62-
protobuf$ CXXFLAGS="-m64" ./configure --disable-shared --prefix=$HOME/protobuf-64
63-
protobuf$ make clean && make && make install
64-
```
65-
66-
6757
#### Windows 64-bit with MSYS2 (Recommended for Windows)
6858
Because the gcc shipped with MSYS2 doesn't support multilib, you have to
6959
compile and deploy 32-bit and 64-bit binaries in separate steps.
@@ -127,30 +117,39 @@ Compilation of the codegen requires additional environment variables to locate
127117
the header files and libraries of Protobuf.
128118

129119
#### Linux
120+
Build the ``grpc-java-deploy`` image:
121+
```
122+
grpc-java$ docker build -t grpc-java-deploy grpc-compiler
123+
```
124+
125+
Start a Docker container that has the deploy environment set up for you. The
126+
gRPC source is cloned into ``/grpc-java``.
130127
```
131-
$ export CXXFLAGS="-I$HOME/protobuf-32/include" \
132-
LDFLAGS="-L$HOME/protobuf-32/lib -L$HOME/protobuf-64/lib"
128+
$ docker run -it --rm=true grpc-java-deploy
133129
```
130+
Note that the container will be deleted after you exit. Any changes you have
131+
made will be lost. If you want to keep the container, remove ``--rm=true`` from
132+
the command line.
134133

135134
#### Windows 64-bit with MSYS2
136135

137136
##### Under MinGW-w64 Win32 Shell
138137

139138
```
140-
$ export CXXFLAGS="-I$HOME/protobuf-32/include" \
139+
grpc-java$ export CXXFLAGS="-I$HOME/protobuf-32/include" \
141140
LDFLAGS="-L$HOME/protobuf-32/lib"
142141
```
143142

144143
##### Under MinGW-w64 Win64 Shell
145144
```
146-
$ export CXXFLAGS="-I$HOME/protobuf-64/include" \
145+
grpc-java$ export CXXFLAGS="-I$HOME/protobuf-64/include" \
147146
LDFLAGS="-L$HOME/protobuf-64/lib"
148147
```
149148

150149

151150
#### Mac
152151
```
153-
$ export CXXFLAGS="-I$HOME/protobuf/include" \
152+
grpc-java$ export CXXFLAGS="-I$HOME/protobuf/include" \
154153
LDFLAGS="$HOME/protobuf/lib/libprotobuf.a $HOME/protobuf/lib/libprotoc.a"
155154
```
156155

compiler/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM protoc-artifacts:latest
2+
3+
RUN scl enable devtoolset-1.1 'bash -c "cd /protobuf && \
4+
git checkout v3.0.0-alpha-2 && \
5+
./autogen.sh && \
6+
CXXFLAGS=-m32 ./configure --disable-shared --prefix=/protobuf-32 && \
7+
make clean && make && make install"'
8+
9+
RUN scl enable devtoolset-1.1 'bash -c "cd /protobuf && \
10+
CXXFLAGS=-m64 ./configure --disable-shared --prefix=/protobuf-64 && \
11+
make clean && make && make install"'
12+
13+
ENV CXXFLAGS -I/protobuf-32/include
14+
ENV LDFLAGS "-L/protobuf-32/lib -L/protobuf-64/lib"
15+
16+
RUN git clone --depth 1 https://github.com/grpc/grpc-java.git
17+
18+
# Start in devtoolset environment that uses GCC 4.7
19+
CMD ["scl", "enable", "devtoolset-1.1", "bash"]

0 commit comments

Comments
 (0)