Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move gradle build in dockerfile #93

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build healthcheck tool
working-directory: healthcheck
run: ./gradlew build
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/deploy-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ jobs:
timeout-minutes: 20
steps:
- uses: actions/checkout@master
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Build healthcheck tool
working-directory: healthcheck
run: ./gradlew build
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ RUN chmod +x ${IBC_PATH}/*.sh ${IBC_PATH}/*/*.sh
# copy IBC/Jts configs
COPY ibc/config.ini ${IBC_INI}

# temp container to build using gradle
FROM gradle:8.7.0-jdk17 AS healthcheck-tools
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY healthcheck $APP_HOME

RUN gradle clean build

RUN mkdir -p $APP_HOME/build

RUN unzip healthcheck/build/distributions/healthcheck.zip -d $APP_HOME/build
RUN unzip healthcheck-rest/build/distributions/healthcheck-rest-boot.zip -d $APP_HOME/build

FROM debian:bookworm-slim
ARG IB_GATEWAY_MAJOR="10"
ARG IB_GATEWAY_MINOR="19"
Expand Down Expand Up @@ -56,7 +69,7 @@ ENV TWS_INSTALL_LOG=/root/Jts/tws_install.log \
IB_GATEWAY_VERSION=${IB_GATEWAY_MAJOR}${IB_GATEWAY_MINOR}

# make dirs
RUN mkdir -p /tmp && mkdir -p ${IBC_PATH} && mkdir -p ${TWS_PATH}
RUN mkdir -p /tmp && mkdir -p ${IBC_PATH} && mkdir -p ${TWS_PATH} && mkdir -p /healthcheck

# download IB TWS
COPY --from=downloader /tmp/ibgw.sh /tmp/ibgw.sh
Expand All @@ -69,11 +82,11 @@ COPY --from=downloader /opt/ibc /opt/ibc
COPY --from=downloader /root/ibc /root/ibc

# install healthcheck tool
ADD healthcheck/healthcheck/build/distributions/healthcheck.tar /
COPY --from=healthcheck-tools /usr/app/build/healthcheck /healthcheck
ENV PATH="${PATH}:/healthcheck/bin"

ADD healthcheck/healthcheck-rest/build/distributions/healthcheck-rest-boot.tar /
ENV PATH="${PATH}:/healthcheck-rest-boot/bin"
COPY --from=healthcheck-tools /usr/app/build/healthcheck-rest-boot /healthcheck-rest
ENV PATH="${PATH}:/healthcheck-rest/bin"

# copy cmd script
WORKDIR /root
Expand Down
21 changes: 17 additions & 4 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ RUN chmod +x ${IBC_PATH}/*.sh ${IBC_PATH}/*/*.sh
# copy IBC/Jts configs
COPY ibc/config.ini ${IBC_INI}

# temp container to build using gradle
FROM gradle:8.7.0-jdk17 AS healthcheck-tools
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
COPY healthcheck $APP_HOME

RUN gradle clean build

RUN mkdir -p $APP_HOME/build

RUN unzip healthcheck/build/distributions/healthcheck.zip -d $APP_HOME/build
RUN unzip healthcheck-rest/build/distributions/healthcheck-rest-boot.zip -d $APP_HOME/build

FROM debian:bookworm-slim
ARG IB_GATEWAY_MAJOR="###IB_GATEWAY_MAJOR###"
ARG IB_GATEWAY_MINOR="###IB_GATEWAY_MINOR###"
Expand Down Expand Up @@ -57,7 +70,7 @@ ENV TWS_INSTALL_LOG=/root/Jts/tws_install.log \
IB_GATEWAY_VERSION=${IB_GATEWAY_MAJOR}${IB_GATEWAY_MINOR}

# make dirs
RUN mkdir -p /tmp && mkdir -p ${IBC_PATH} && mkdir -p ${TWS_PATH}
RUN mkdir -p /tmp && mkdir -p ${IBC_PATH} && mkdir -p ${TWS_PATH} && mkdir -p /healthcheck

# download IB TWS
COPY --from=downloader /tmp/ibgw.sh /tmp/ibgw.sh
Expand All @@ -70,11 +83,11 @@ COPY --from=downloader /opt/ibc /opt/ibc
COPY --from=downloader /root/ibc /root/ibc

# install healthcheck tool
ADD healthcheck/healthcheck/build/distributions/healthcheck.tar /
COPY --from=healthcheck-tools /usr/app/build/healthcheck /healthcheck
ENV PATH="${PATH}:/healthcheck/bin"

ADD healthcheck/healthcheck-rest/build/distributions/healthcheck-rest-boot.tar /
ENV PATH="${PATH}:/healthcheck-rest-boot/bin"
COPY --from=healthcheck-tools /usr/app/build/healthcheck-rest-boot /healthcheck-rest
ENV PATH="${PATH}:/healthcheck-rest/bin"

# copy cmd script
WORKDIR /root
Expand Down