Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

Commit a41e47a

Browse files
author
Takashi Matsuo
authored
Merge pull request #432 from tmatsuo/ubuntu
Build deb packages for ubuntu 16.04
2 parents fdbfdc0 + 0f35099 commit a41e47a

File tree

398 files changed

+6571
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+6571
-0
lines changed

ubuntu-package-builder/Dockerfile

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Dockerfile used to build php binaries.
16+
# Example usage:
17+
# docker run -v /mydir:/workspace deb-package-builder 5.6.29-1,7.0.14-2
18+
# Then you'll get deb packages in /mydir.
19+
20+
FROM gcr.io/gcp-runtimes/ubuntu_16_0_4
21+
22+
ENV PHP_DIR=/opt/php \
23+
PATH=/opt/php/bin:$PATH
24+
25+
# Need to install debian packaging tools etc
26+
RUN apt-get update -y && \
27+
apt-get install -y -q --no-install-recommends \
28+
# Tools
29+
git \
30+
# PHP deps
31+
curl \
32+
libcurl3-gnutls \
33+
gettext \
34+
libbz2-1.0 \
35+
libgmp10 \
36+
libicu55 \
37+
libjpeg-turbo8 \
38+
liblua5.3-0 \
39+
libmcrypt4 \
40+
libmemcached11 \
41+
libmemcachedutil2 \
42+
libpcre3 \
43+
libpng12-0 \
44+
libpq5 \
45+
libreadline6 \
46+
librecode0 \
47+
libsasl2-modules \
48+
libsqlite3-0 \
49+
libxml2 \
50+
libxslt1.1 \
51+
sasl2-bin \
52+
zlib1g \
53+
# debian packages
54+
debhelper \
55+
devscripts \
56+
libparse-debcontrol-perl \
57+
# headers
58+
libbz2-dev \
59+
libcurl4-gnutls-dev \
60+
libfreetype6-dev \
61+
libgettextpo-dev \
62+
libgmp-dev \
63+
libuv1-dev \
64+
libicu-dev \
65+
libjpeg-turbo8-dev \
66+
libjson-c-dev \
67+
liblua5.3-dev \
68+
libmagick++-dev \
69+
libmcrypt-dev \
70+
libmemcached-dev \
71+
libpcre3-dev \
72+
libpng-dev \
73+
libpq-dev \
74+
libreadline6-dev \
75+
librecode-dev \
76+
libsasl2-dev \
77+
libsqlite3-dev \
78+
libsodium-dev \
79+
libssl-dev \
80+
libxml2-dev \
81+
libxslt1-dev \
82+
zlib1g-dev \
83+
# build tools
84+
build-essential \
85+
autoconf \
86+
bison \
87+
file \
88+
g++ \
89+
gcc \
90+
libc-dev \
91+
make \
92+
patch \
93+
pkg-config \
94+
re2c \
95+
binutils \
96+
# build tools for cassandra
97+
cmake \
98+
dh-exec \
99+
lsb-release \
100+
fakeroot \
101+
libtool \
102+
automake \
103+
autotools-dev
104+
105+
COPY build.sh /
106+
RUN chmod 0755 /build.sh
107+
RUN mkdir -p /workspace
108+
WORKDIR /workspace
109+
110+
# COPY debian /workspace/debian
111+
# COPY extensions /workspace/extensions
112+
# COPY functions.sh /workspace/functions.sh
113+
# COPY libraries /workspace/libraries
114+
# COPY gpgkeys /workspace/gpgkeys
115+
116+
ENTRYPOINT ["/build.sh"]

ubuntu-package-builder/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Debian Package Builder
2+
3+
This directory contains the code to build all of our debian packages for php and extensions.
4+
5+
## PHP Versions
6+
7+
We currently support the latest patch version of 5.6, 7.0, 7.1, and 7.2. See
8+
[releases](https://github.com/GoogleCloudPlatform/php-docker/releases) for exact versions.
9+
10+
## Extensions
11+
12+
* amqp
13+
* apcu
14+
* apcu_bc
15+
* apm (7.0+)
16+
* couchbase (7.0+)
17+
* ds (7.0+)
18+
* eio
19+
* ev
20+
* event
21+
* gprc
22+
* hprose
23+
* imagick
24+
* jsonc
25+
* jsond
26+
* krb5
27+
* libsodium (7.0, 7.1)
28+
* lua (7.0+)
29+
* LZF
30+
* mailparse
31+
* memcache
32+
* memcached
33+
* memprof
34+
* mongo [deprecated] (5.6)
35+
* mongodb
36+
* oauth
37+
* opencensus
38+
* phalcon
39+
* pq
40+
* raphf
41+
* rdkafka
42+
* redis
43+
* SeasLog
44+
* stackdriver_debugger
45+
* stomp
46+
* suhosin
47+
* swoole
48+
* sync
49+
* tcpwrap
50+
* timezonedb
51+
* v8js (7.0+)
52+
* vips (7.0+)
53+
* yaconf (7.0+)
54+
* yaf
55+
* yaml
56+
57+
## Building Packages
58+
59+
1. Install `gcloud` utils.
60+
2. `GOOGLE_PROJECT_ID=my_project_id ./build_packages.sh`
61+
62+
This will use Google Cloud Container Builder to compile packages using docker. The compiled .deb files will be
63+
uploaded to the bucket named `$BUCKET` (defaults to the project id).
64+
65+
If you want to build for specific versions of PHP, set the `$PHP_VERSIONS` environment variable to a comma separated list
66+
of PHP versions. This defaults to a hard-coded list defined in the `build_packages.sh` file
67+
68+
## Adding New Extensions
69+
70+
This folder contains a `new_extension.sh` script to generate the skeleton for
71+
adding support for a new extension.
72+
73+
Example:
74+
75+
```bash
76+
$ ./new_extension.sh
77+
Usage: new_extension.sh <extension name> <upstream maintainer name> <upstream homepage> <package maintainer>
78+
79+
$ ./new_extension.sh grpc "Stanley Cheung <stanleycheung@google.com>" http://pecl.php.net/package/grpc "Jeff Ching <chingor@google.com>"
80+
```
81+
82+
This will generate a folder `extensions/grpc` with the following directory
83+
structure:
84+
85+
```
86+
grpc/
87+
|--- debian/
88+
| |--- compat
89+
| |--- control.in
90+
| |--- copyright
91+
| |--- ext-grpc.ini
92+
| |--- gcp-php-grpc.install.in
93+
| |--- rules.in
94+
|--- build.sh
95+
```
96+
97+
The `build.sh` script is the entrypoint for generating the `.deb` package file
98+
and the `debian` folder contains the necessary packaging configuration.
99+
100+
If the extension requires a development dependency, be sure to add an
101+
`apt-get install -y <dev dependency>` to the `build.sh` file. If the extension
102+
requires a runtime dependency, be sure to add it to the `control.in` file.
103+
104+
You may need to update the license section of the `debian/copyright` file to
105+
match the license of the PHP extension.
106+
107+
You may also need to modify the `build.sh` file to skip builds for unsupported
108+
PHP versions (see libsodium for an example) or to specify an older version (see
109+
mailparse for an example).
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
steps:
2+
- name: gcr.io/cloud-builders/docker
3+
args: ['build', '-t', 'gcr.io/${_GOOGLE_PROJECT_ID}/deb-package-builder', '.']
4+
waitFor: ['-']
5+
id: deb-package-builder
6+
7+
# create local directories for the rsync
8+
- name: gcr.io/google-appengine/debian8
9+
args: ['mkdir', '-p', '/workspace/pkg/libraries', '/workspace/pkg/${_PHP_VERSION}']
10+
waitFor: ['-']
11+
id: artifact-dirs
12+
13+
# create gs folders if necessary or rsync fails
14+
- name: gcr.io/cloud-builders/gsutil
15+
args: ['cp', '/workspace/pkg/.gitkeep', 'gs://${_BUCKET}/ubuntu-packages/libraries/']
16+
waitFor: ['-']
17+
id: ensure-libraries-folder
18+
- name: gcr.io/cloud-builders/gsutil
19+
args: ['cp', '/workspace/pkg/.gitkeep', 'gs://${_BUCKET}/ubuntu-packages/${_PHP_VERSION}/']
20+
waitFor: ['-']
21+
id: ensure-packages-folder
22+
23+
# rsync already created packages so we don't rebuild
24+
- name: gcr.io/cloud-builders/gsutil
25+
args: ['-m', 'rsync', 'gs://${_BUCKET}/ubuntu-packages/libraries', '/workspace/pkg/libraries']
26+
waitFor: ['artifact-dirs', 'ensure-libraries-folder']
27+
id: import-libraries
28+
- name: gcr.io/cloud-builders/gsutil
29+
args: ['-m', 'rsync', 'gs://${_BUCKET}/ubuntu-packages/${_PHP_VERSION}', '/workspace/pkg/${_PHP_VERSION}']
30+
waitFor: ['artifact-dirs', 'ensure-packages-folder']
31+
id: import-packages
32+
33+
# build the packages
34+
- name: gcr.io/${_GOOGLE_PROJECT_ID}/deb-package-builder
35+
args: ['${_PHP_VERSION}']
36+
waitFor: ['deb-package-builder', 'import-libraries', 'import-packages']
37+
id: package-build
38+
39+
# export artifacts to gs
40+
- name: gcr.io/cloud-builders/gsutil
41+
args: ['-m', 'rsync', '/workspace/pkg/libraries/', 'gs://${_BUCKET}/ubuntu-packages/libraries/']
42+
waitFor: ['package-build']
43+
id: 'export-libraries'
44+
- name: gcr.io/cloud-builders/gsutil
45+
args: ['-m', 'rsync', '/workspace/pkg/${_PHP_VERSION}/', 'gs://${_BUCKET}/ubuntu-packages/${_PHP_VERSION}/']
46+
waitFor: ['package-build']
47+
id: 'export-packages'

0 commit comments

Comments
 (0)