Skip to content

Commit 950a5e1

Browse files
committed
Signed-off-by: gnzsnz <[email protected]>
1 parent 4826a19 commit 950a5e1

39 files changed

+1339
-1496
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,37 @@ A clear and concise description of what the bug is.
1313

1414
## To Reproduce
1515

16-
Steps to reproduce the behavior. Please include information related to docker, ex docker run command, .env file, docker-compose.yml.
16+
Steps to reproduce the behavior. Please include information related to docker,
17+
ex docker run command, .env file, docker-compose.yml.
1718

1819
Please provide the output of `docker compose config`
1920

20-
## Expected behavior
21+
## Expected
22+
2123
A clear and concise description of what you expected to happen.
2224

2325
## Container logs
24-
If applicable, add the container logs `docker logs <CONTAINER>` or `docker-compose logs` to help explain your problem.
26+
27+
If applicable, add the container logs `docker logs <CONTAINER>` or
28+
`docker-compose logs` to help explain your problem.
2529

2630
## Versions
2731

2832
Please complete the following information:
29-
- OS: [e.g. Windows]
30-
- Docker version: [e.g. chrome, safari]
31-
- Image Tag (`docker image inspect ghcr.io/gnzsnz/ib-gateway:tag`): [e.g. latest]
32-
- Image Digest (`docker images --digests`): [e.g. sha256:60d9d54009b1b66908bbca1ebf5b8a03a39fe0cb35c2ab4023f6e41b55d17894]
33+
34+
- OS: [e.g. Windows]
35+
- Docker version: [e.g. chrome, safari]
36+
- Image Tag (`docker image inspect ghcr.io/gnzsnz/ib-gateway:tag`): [e.g.
37+
latest]
38+
- Image Digest (`docker images --digests`): [e.g.
39+
sha256:60d9d54009b1b66908bbca1ebf5b8a03a39fe0cb35c2ab4023f6e41b55d17894]
3340

3441
## Additional context
42+
3543
Add any other context about the problem here.
3644

3745
What have you tried and failed.
3846

39-
My primary objective is to fix any bug on the container, ex Dockerfile, run.sh script, docker-compose.yml. Please don't expect upstream issues to be solved here (ex. IB gateway, IBC, etc)
47+
My primary objective is to fix any bug on the container, ex Dockerfile, run.sh
48+
script, docker-compose.yml. Please don't expect upstream issues to be solved
49+
here (ex. IB gateway, IBC, etc)

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
10+
## Is your feature request related to a problem? Please describe
11+
1112
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
1213

13-
**Describe the solution you'd like**
14+
## Describe the solution you'd like
15+
1416
A clear and concise description of what you want to happen.
1517

16-
**Describe alternatives you've considered**
18+
## Describe alternatives you've considered
19+
1720
A clear and concise description of any alternative solutions or features you've considered.
1821

19-
**Additional context**
22+
## Additional context
23+
2024
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ updates:
99
directory: "/stable"
1010
schedule:
1111
interval: "daily"
12-
12+
1313
- package-ecosystem: "docker"
1414
directory: "/latest"
1515
schedule:
1616
interval: "daily"
17-
17+
1818
- package-ecosystem: "github-actions"
1919
directory: "/"
2020
schedule:

.github/workflows/detect-ibc-release.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ on:
66

77
workflow_dispatch:
88

9+
defaults:
10+
run:
11+
shell: "bash -Eeuo pipefail -x {0}"
12+
913
env:
1014
IBC_REPO: https://github.com/IbcAlpha/IBC.git
1115
BRANCH_PREFIX: IBC-update
1216
jobs:
1317
detect-release:
18+
name: Detect Release
1419
runs-on: ubuntu-latest
20+
outputs:
21+
update: ${{ steps.verify_latest.outputs.update }}
1522
strategy:
1623
fail-fast: true
1724

@@ -23,9 +30,11 @@ jobs:
2330
run: |
2431
CURRENT_IBC="$(grep 'ENV IBC_VERSION' Dockerfile.template|cut -d '=' -f 2)"
2532
echo "CURRENT_IBC=$CURRENT_IBC" >> $GITHUB_OUTPUT
26-
33+
2734
- name: Get IBC latest version
2835
id: ibc_version
36+
env:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2938
run: |
3039
IBC_LATEST="$(gh release list -R ${{ env.IBC_REPO }} --exclude-drafts --exclude-pre-releases |grep 'Latest'|cut -f1)"
3140
if [ -n ${IBC_LATEST} ]
@@ -76,7 +85,7 @@ jobs:
7685
git config user.email [email protected]
7786
git pull
7887
git checkout -b "$branch" origin/master
79-
88+
8089
# update Dockerfile.template, but don't run update.sh
8190
# next ib gateway release will run update.sh
8291
sed -i "s/IBC_VERSION=${ver}/IBC_VERSION=${latest}/g" Dockerfile.template
@@ -85,5 +94,16 @@ jobs:
8594
git commit -m "Update IBC from ${ver} to ${latest}"
8695
git push --set-upstream origin "$branch"
8796
88-
gh pr create --base master --fill
97+
gh pr create --base master --fill
98+
8999
100+
build:
101+
name: Call build workflow
102+
needs: detect-release
103+
if: needs.detect-release.outputs.update == 'true'
104+
strategy:
105+
matrix:
106+
channel: ['stable', 'latest']
107+
uses: gnzsnz/ib-gateway-docker/.github/workflows/build.yml@master
108+
with:
109+
channel: ${{ matrix.channel }}

.github/workflows/detect-releases.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ defaults:
1313
jobs:
1414
detect-release:
1515
runs-on: ubuntu-latest
16+
outputs:
17+
update: ${{ steps.check-update.outputs.has_update }}
18+
channel: ${{ matrix.channel }}
1619
strategy:
1720
fail-fast: true
1821
matrix:
@@ -112,3 +115,12 @@ jobs:
112115
git push --set-upstream origin "$t_branch"
113116
114117
gh pr create --base master --fill
118+
119+
120+
build:
121+
name: Call build workflow
122+
needs: detect-release
123+
if: needs.detect-release.outputs.update == 'true'
124+
uses: gnzsnz/ib-gateway-docker/.github/workflows/build.yml@master
125+
with:
126+
channel: ${{ needs.detect-release.outputs.channel }}

.github/workflows/publish.yml

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "Publish Docker"
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- 'v*'
77

88
jobs:
99
publish-docker:
@@ -23,22 +23,11 @@ jobs:
2323
echo "channel=$channel" >> $GITHUB_OUTPUT
2424
2525
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v3
27-
28-
- name: Docker meta
29-
id: meta
30-
uses: docker/metadata-action@v5
31-
with:
32-
images: |
33-
ghcr.io/gnzsnz/ib-gateway
34-
gnzsnz/ib-gateway
35-
flavor: |
36-
latest=false
37-
tags: |
38-
type=match,pattern=v(\d+.\d+),group=1
39-
type=match,pattern=v(\d+.\d+.\w+),group=1
40-
type=match,pattern=v(\d+.\d+.\w+)+\-(stable|latest),group=2
26+
uses: docker/setup-buildx-action@v3
4127

28+
###############################################################
29+
# Login container registry
30+
###############################################################
4231
- name: Log in to the Container registry
4332
uses: docker/login-action@v3
4433
with:
@@ -51,8 +40,26 @@ jobs:
5140
with:
5241
username: ${{ secrets.DOCKERHUB_USERNAME }}
5342
password: ${{ secrets.DOCKERHUB_TOKEN }}
54-
55-
- name: Build and push
43+
44+
###############################################################
45+
# Build ibgateway
46+
###############################################################
47+
48+
- name: Docker meta ibgateway
49+
id: meta
50+
uses: docker/metadata-action@v5
51+
with:
52+
images: |
53+
ghcr.io/gnzsnz/ib-gateway
54+
gnzsnz/ib-gateway
55+
flavor: |
56+
latest=false
57+
tags: |
58+
type=match,pattern=v(\d+.\d+),group=1
59+
type=match,pattern=v(\d+.\d+.\w+),group=1
60+
type=match,pattern=v(\d+.\d+.\w+)+\-(stable|latest),group=2
61+
62+
- name: Build and push ibgateway
5663
uses: docker/build-push-action@v5
5764
with:
5865
context: ${{ steps.channel.outputs.channel }}
@@ -61,3 +68,32 @@ jobs:
6168
push: true
6269
tags: ${{ steps.meta.outputs.tags }}
6370
labels: ${{ steps.meta.outputs.labels }}
71+
72+
###############################################################
73+
# Build tws
74+
###############################################################
75+
76+
- name: Docker meta TWS
77+
id: meta-tws
78+
uses: docker/metadata-action@v5
79+
with:
80+
images: |
81+
ghcr.io/gnzsnz/tws-rdesktop
82+
gnzsnz/tws-rdesktop
83+
flavor: |
84+
latest=false
85+
tags: |
86+
type=match,pattern=v(\d+.\d+),group=1
87+
type=match,pattern=v(\d+.\d+.\w+),group=1
88+
type=match,pattern=v(\d+.\d+.\w+)+\-(stable|latest),group=2
89+
90+
- name: Build and push TWS
91+
uses: docker/build-push-action@v5
92+
with:
93+
context: ${{ steps.channel.outputs.channel }}
94+
file: ${{ steps.channel.outputs.channel }}/Dockerfile.tws
95+
cache-from: type=gha
96+
cache-to: type=gha,mode=max
97+
push: true
98+
tags: ${{ steps.meta-tws.outputs.tags }}
99+
labels: ${{ steps.meta-tws.outputs.labels }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.env
22
tws_settings/
33
ssh/
4+
/config/
5+
.python-version

.pre-commit-config.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.6.0
6-
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
11-
- id: check-shebang-scripts-are-executable
12-
- id: check-executables-have-shebangs
13-
- repo: https://github.com/jumanjihouse/pre-commit-hooks
14-
rev: 3.0.0
15-
hooks:
16-
- id: shellcheck
17-
- id: shfmt
18-
- repo: https://github.com/hadolint/hadolint
19-
rev: v2.12.1-beta
20-
hooks:
21-
- id: hadolint
22-
- repo: https://github.com/igorshubovych/markdownlint-cli
23-
rev: v0.39.0
24-
hooks:
25-
- id: markdownlint
26-
- repo: https://github.com/wemake-services/dotenv-linter
27-
rev: 0.5.0 # Use the ref you want to point at
28-
hooks:
29-
- id: dotenv-linter
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.5.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-shebang-scripts-are-executable
12+
- id: check-executables-have-shebangs
13+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
14+
rev: 3.0.0
15+
hooks:
16+
- id: shellcheck
17+
- id: shfmt
18+
- repo: https://github.com/hadolint/hadolint
19+
rev: v2.12.0
20+
hooks:
21+
- id: hadolint-docker
22+
- repo: https://github.com/igorshubovych/markdownlint-cli
23+
rev: v0.37.0
24+
hooks:
25+
- id: markdownlint
26+
- repo: https://github.com/wemake-services/dotenv-linter
27+
rev: 0.4.0 # Use the ref you want to point at
28+
hooks:
29+
- id: dotenv-linter

Dockerfile.template

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##############################################################################
22
# Setup Stage: install apps
33
#
4-
# This is a dedicated stage so that donwload archives don't end up on
4+
# This is a dedicated stage so that donwload archives don't end up on
55
# production image and consume unnecessary space.
66
##############################################################################
77

@@ -53,14 +53,17 @@ ENV IB_GATEWAY_VERSION=$VERSION
5353
ARG USER_ID="${USER_ID:-1000}"
5454
ARG USER_GID="${USER_GID:-1000}"
5555
# IBC env vars
56+
ENV HOME=/home/ibgateway
5657
ENV TWS_MAJOR_VRSN=${IB_GATEWAY_VERSION}
57-
ENV TWS_PATH=/home/ibgateway/Jts
58+
ENV TWS_PATH=${HOME}/Jts
5859
ENV TWS_INI=jts.ini
59-
ENV IBC_PATH=/home/ibgateway/ibc
60-
ENV IBC_INI=/home/ibgateway/ibc/config.ini
60+
ENV IBC_PATH=${HOME}/ibc
61+
ENV IBC_INI=${HOME}/ibc/config.ini
62+
ENV SCRIPT_PATH=${HOME}/scripts
63+
ENV GATEWAY_OR_TWS=gateway
6164
# Copy files
6265
COPY --from=setup /usr/local/i4j_jres/ /usr/local/i4j_jres
63-
COPY --chown=${USER_ID}:${USER_GID} --from=setup /root/ /home/ibgateway/
66+
COPY --chown=${USER_ID}:${USER_GID} --from=setup /root/ ${HOME}
6467

6568
# Prepare system
6669
RUN apt-get update -y && \
@@ -70,10 +73,10 @@ RUN apt-get update -y && \
7073
rm -rf /var/lib/apt/lists/* && \
7174
groupadd --gid ${USER_GID} ibgateway && \
7275
useradd -ms /bin/bash --uid ${USER_ID} --gid ${USER_GID} ibgateway && \
73-
chmod a+x /home/ibgateway/scripts/*.sh
76+
chmod a+x ${SCRIPT_PATH}/*.sh
7477

7578
USER ${USER_ID}:${USER_GID}
76-
WORKDIR /home/ibgateway/
79+
WORKDIR ${HOME}
7780

7881
# Start run script
7982
CMD ["/home/ibgateway/scripts/run.sh"]

0 commit comments

Comments
 (0)