mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-07 21:48:16 -08:00
Merge pull request #13 from harukasan/feature/docker
Make enable to test on docker.
This commit is contained in:
commit
1291ea2ac7
3 changed files with 68 additions and 10 deletions
13
.travis.yml
13
.travis.yml
|
|
@ -10,6 +10,8 @@ env:
|
|||
- LIBWEBP_VERSION="0.4.2"
|
||||
- LIBWEBP_VERSION="0.4.3"
|
||||
- LIBWEBP_VERSION="0.5.0"
|
||||
- LIBWEBP_VERSION="0.5.1"
|
||||
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
|
@ -17,16 +19,7 @@ cache:
|
|||
sudo: false
|
||||
|
||||
before_install:
|
||||
- >
|
||||
test -e $HOME/cache/libwebp-${LIBWEBP_VERSION}/lib/libwebp.so || (
|
||||
cd /tmp
|
||||
&& wget http://downloads.webmproject.org/releases/webp/libwebp-${LIBWEBP_VERSION}.tar.gz
|
||||
&& tar xf libwebp-${LIBWEBP_VERSION}.tar.gz
|
||||
&& cd libwebp-${LIBWEBP_VERSION}
|
||||
&& ./configure --prefix=$HOME/cache/libwebp-${LIBWEBP_VERSION}
|
||||
&& make
|
||||
&& make install
|
||||
)
|
||||
- LIBWEBP_PREFIX=$HOME/cache/libwebp-${LIBWEBP_VERSION} make libwebp
|
||||
- cd $HOME/gopath/src/github.com/harukasan/go-libwebp
|
||||
- export CGO_CFLAGS="-I $HOME/cache/libwebp-${LIBWEBP_VERSION}/include"
|
||||
- export CGO_LDFLAGS="-L $HOME/cache/libwebp-${LIBWEBP_VERSION}/lib"
|
||||
|
|
|
|||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
FROM alpine:3.4
|
||||
|
||||
RUN apk add --no-cache g++ make go
|
||||
|
||||
RUN mkdir -p /tmp/go-libwebp
|
||||
COPY Makefile /tmp/go-libwebp/Makefile
|
||||
|
||||
ENV LIBWEBP_PREFIX="/usr/local" \
|
||||
LIBWEBP_VERSION="0.5.1"
|
||||
RUN cd /tmp/go-libwebp && make libwebp
|
||||
|
||||
ENV GOPATH="/go" \
|
||||
WORKDIR="/go/src/github.com/harukasan/go-libwebp" \
|
||||
PATH="/go/bin:/usr/local/go/bin:$PATH" \
|
||||
CGO_CFLAGS="-I /usr/local/include" \
|
||||
CGO_LDFLAGS="-L /usr/local/lib" \
|
||||
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
RUN mkdir -p $WORKDIR
|
||||
VOLUME $WORKDIR
|
||||
WORKDIR $WORKDIR
|
||||
|
||||
CMD ["make", "test"]
|
||||
42
Makefile
Normal file
42
Makefile
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
repo = github.com/harukasan/go-libwebp
|
||||
build_dir = /tmp
|
||||
cur_dir = $(shell pwd)
|
||||
libwebp_so = ${LIBWEBP_PREFIX}/lib/libwebp.so
|
||||
LIBWEBP_VERSION ?= 0.5.1
|
||||
|
||||
all: test
|
||||
|
||||
test:
|
||||
go test -v $(repo)/...
|
||||
|
||||
libwebp: $(libwebp_so)
|
||||
|
||||
$(libwebp_so):
|
||||
cd $(build_dir) \
|
||||
&& wget http://downloads.webmproject.org/releases/webp/libwebp-$(LIBWEBP_VERSION).tar.gz \
|
||||
&& tar xf libwebp-$(LIBWEBP_VERSION).tar.gz \
|
||||
&& cd libwebp-$(LIBWEBP_VERSION) \
|
||||
&& ./configure --prefix=$(LIBWEBP_PREFIX) \
|
||||
&& make \
|
||||
&& make install
|
||||
|
||||
docker-test:
|
||||
docker run -v $(cur_dir):/go/src/$(repo) -it go-libwebp:$(LIBWEBP_VERSION)
|
||||
|
||||
docker-sh:
|
||||
docker run -v $(cur_dir):/go/src/$(repo) -it go-libwebp:$(LIBWEBP_VERSION) sh
|
||||
|
||||
docker-build:
|
||||
docker build -t go-libwebp:$(LIBWEBP_VERSION) .
|
||||
|
||||
docker-clean:
|
||||
docker rm $$(docker ps -a -q -f "ancestor=go-libwebp")
|
||||
|
||||
.PHONY: \
|
||||
all \
|
||||
test \
|
||||
libwebp \
|
||||
docker-test \
|
||||
docker-sh \
|
||||
docker-build \
|
||||
docker-clean
|
||||
Loading…
Add table
Add a link
Reference in a new issue