Skip to content

Commit 89256d8

Browse files
authored
Merge pull request #2 from tech-thinker/offline-script-support
offline script support added
2 parents 45cfbcc + f12c60e commit 89256d8

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,41 @@
11
# Script-Runner
2-
It will run script from any public url.
2+
It will run script from any public url or local file.
33

44
## Environment Variables:
55
- `SCRIPT_URL`: Is used to specify script url.
6+
- `SCRIPT_PATH`: Is used to specify local script file.
67

78
## How to use?
8-
### In Docker:
9+
### Using Docker:
10+
- Create `Dockerfile`
11+
```
12+
FROM techthinkerorg/script-runner:1.1.0
13+
WORKDIR /script
14+
COPY ./your-script.sh /script/
15+
ENV SCRIPT_PATH "your-script.sh"
16+
```
17+
or
18+
```
19+
FROM techthinkerorg/script-runner:1.1.0
20+
ENV SCRIPT_URL "script-location-url.sh"
21+
```
22+
- Run `docker build -f ./Dockerfile -t your-image-name .`
23+
- Run `docker run your-image-name`
24+
25+
### Using Docker Compose:
926
- Create `docker-compose.yaml`
1027
```yaml
1128
version: "3"
1229
services:
1330
script:
1431
container_name: script-runner
15-
image: techthinkerorg/script-runner:1.0.0
32+
image: techthinkerorg/script-runner:1.1.0
1633
environment:
1734
- SCRIPT_URL=script-location-url.sh
1835
```
1936
- Run compose file `docker-compose up`
2037

21-
### In Kubernetes:
38+
### Using Kubernetes:
2239
- Create `your-deployment-corn.yaml`
2340
```yaml
2441
apiVersion: batch/v1beta1
@@ -34,7 +51,7 @@ spec:
3451
spec:
3552
containers:
3653
- name: your-deployment-cron
37-
image: techthinkerorg/script-runner:1.0.0
54+
image: techthinkerorg/script-runner:1.1.0
3855
env:
3956
- name: SCRIPT_URL
4057
value: "script-location-url.sh"

script.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#!/bin/sh
2-
curl -sS -X GET "${SCRIPT_URL}" | sh
2+
if [[ -z "${SCRIPT_URL}" ]]; then
3+
cat "${SCRIPT_PATH}" | sh
4+
else
5+
curl -sS -X GET "${SCRIPT_URL}" | sh
6+
fi

0 commit comments

Comments
 (0)