Skip to content

Commit

Permalink
Add support for docker (wgzhao#265)
Browse files Browse the repository at this point in the history
Add support for docker wgzhao#257
  • Loading branch information
wgzhao authored Jul 28, 2021
1 parent 46059a6 commit 8959982
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM maven:3.8-jdk-8
COPY . /src
WORKDIR /src

RUN mkdir /root/.m2 && echo '<?xml version="1.0" encoding="UTF-8"?><settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><mirrors><mirror><id>tencent</id><mirrorOf>*</mirrorOf><name>tencent cloud</name><url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url></mirror></mirrors></settings>' >/root/.m2/settings.xml && \
mvn clean package && \
mvn package assembly:single && \
./shrink_package.sh && \
rm -f target/addax/addax-*.tar.gz

FROM airdock/oraclejdk:1.8
COPY --from=0 /src/target/addax/addax-* /opt/addax/

WORKDIR /opt/addax

RUN chmod 755 /opt/addax/bin/*

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ add support for almost basic data type, and some complex data type.

## quick started

### Use docker image

```shell
docker pull wgzhao/addax:latest
docker run -ti --rm --name addax wgzhao/addax:latest /opt/addax/bin/addax.sh /opt/addax/job/job.json
```

### Do not want to compile?

If you are too lazy to compile or cannot compile because of your environment, you can download the corresponding version from the following link
Expand Down
7 changes: 7 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@

## 快速开始

### 使用 Docker 镜像

```shell
docker pull wgzhao/addax:latest
docker run -ti --rm --name addax wgzhao/addax:latest /opt/addax/bin/addax.sh /opt/addax/job/job.json
```

### 不想编译

如果你懒得编译或者因为环境无法编译,可以从以下链接下载对应的版本
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/bin/addax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function gen_log_file {

# OS detect
os=$(uname -s)

if [ "x${os}" = "xDarwin" ]; then
has_get_opt=$(which getopt 2>/dev/null)
if [ "x${os}" = "xDarwin" -o "x${has_get_opt}" = "x" ]; then
while getopts 'hj:p:l:vdL:' option; do
case "$option" in
h) usage ;;
Expand Down
6 changes: 2 additions & 4 deletions shrink_package.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ do
plugin_dir=$(dirname $jar)
file_name=$(basename $jar)
# 1. move it to shared folder
/usr/bin/mv -f ${jar} shared/
/bin/mv -f ${jar} shared/
# 2. create symbol link
cd ${plugin_dir}
ln -sf ../../../../shared/${file_name} $file_name
cd -
( cd ${plugin_dir} && ln -sf ../../../../shared/${file_name} $file_name )
done

# create archive package
Expand Down

0 comments on commit 8959982

Please sign in to comment.