Skip to content

Commit c0fc09e

Browse files
Reggie Burnettdveeden
authored andcommitted
Docker support
dockerfile and docker-compose needed to add docker support for building and testing.
1 parent 2a5e607 commit c0fc09e

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu
2+
3+
#ENV http_proxy=http://www-proxy.us.oracle.com:80
4+
#ENV https_proxy=http://www-proxy.us.oracle.com:80
5+
6+
RUN apt update
7+
RUN apt upgrade -y
8+
RUN apt install -y gcc make libmysqlclient-dev cpanminus libdbi-perl
9+
RUN cpanm install Devel::CheckLib
10+
RUN cpanm install Test::Deep
11+
12+
ENV http_proxy=
13+
ENV https_proxy=
14+
15+
## Add the wait script to the image
16+
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
17+
RUN chmod +x /wait
18+
19+
WORKDIR /driver
20+
COPY . .
21+
22+
RUN perl ./Makefile.PL --testuser=root --testhost=mysqldb --testport=3306 --testdb=test
23+
24+
CMD /wait && make && make test
25+

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ This is the Perl [DBI](https://metacpan.org/pod/DBI) driver for access to MySQL
66

77
Usage is described in [DBD::mysql](https://metacpan.org/pod/DBD::mysql).
88

9+
## Building and Testing Using Docker
10+
11+
We've include some basic docker support for building and testing. This uses an Ubuntu image. It can be used as follows:
12+
13+
docker-compose build
14+
docker-compose up --abort-on-container-exit --exit-code-from test
15+
916
## Installation
1017

1118
Installation is described in [DBD::mysql::INSTALL](https://metacpan.org/pod/DBD::mysql::INSTALL).

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.3'
2+
3+
services:
4+
mysqldb:
5+
image: mysql:8.0
6+
environment:
7+
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
8+
MYSQL_ROOT_HOST: '%'
9+
MYSQL_DATABASE: test
10+
11+
test:
12+
depends_on:
13+
- mysqldb
14+
build:
15+
context: .
16+
environment:
17+
WAIT_HOSTS: mysqldb:3306

0 commit comments

Comments
 (0)