-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from snguyen1/optimize-image-size
Optimize image size
- Loading branch information
Showing
6 changed files
with
93 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
HOST_DATA_ABS_DIR="/abs/path/to/data/dir" | ||
HOST_SCRIPT_ABS_DIR="/abs/path/to/script/dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Docker Hub Push | ||
on: | ||
push: | ||
# Publish semver tags as releases. | ||
tags: [ '*' ] | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
pull: true | ||
cache-from: type=registry,ref=sondngyn/wgrib2:latest | ||
cache-to: type=inline | ||
tags: sondngyn/wgrib2:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.env | ||
data/* | ||
.env | ||
data | ||
script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
WGRIB2 on Container (Debian Bulleyes) | ||
### Note: I update the container based on: https://hub.docker.com/r/bearstudio/wgrib/ | ||
## USAGE | ||
|
||
### Build: | ||
`docker build -t sondngyn/wgrib2 .` | ||
### On Linux: | ||
`docker run -v /path/to/data:/srv/ -v /path/to/script:/opt/ sondngyn/wgrib2 /opt/script_file_name.sh` | ||
### On Windows: | ||
*Note: | ||
Remember to put `#!bin/bash` in the beginning of your script file | ||
Make sure your script file uses LF (Linux line break types) instead of CRLF (Windows). You can easily change it on VS Code | ||
`docker run -v C:\absolute\path\to\data\dir\:/srv/ -v C:\absolute\path\to\script\dir\:/opt/ sondngyn/wgrib2 /opt/script_file_name.sh` | ||
(watch out for back-slashes and forward-slashes) | ||
### Example on Windows (powershell): | ||
`docker run -v C:\Users\myuser\mydata\:/srv/ -v C:\Users\myuser\myscript\:/opt/ sondngyn/wgrib2 /opt/myscript.sh` | ||
|
||
## DEV: | ||
0. Clean up: `docker container rm wgrib2 -f` | ||
1. Build image: `docker build -t wgrib2 .` | ||
2. Spin up container: `docker run --rm --name wgrib2 -d -it wgrib2` | ||
3. Exec: `docker exec -it wgrib2 bash` | ||
WGRIB2 on Container (Debian Bulleyes) | ||
### Note: I update the container based on: https://hub.docker.com/r/bearstudio/wgrib/ | ||
## USAGE | ||
|
||
### Usage: | ||
|
||
#### Docker-Compose CLI | ||
Create `.env` file from `.env.dist` and change the env values to the dirs location on your computer (for windows, use `/c/abs/path/`) | ||
`docker-compose build wgrib2` | ||
`docker-compose up wgrib2` (change `command` in docker-compose file to your script filename before running `up`) | ||
|
||
#### Docker CLI | ||
`docker build -t wgrib2 .` | ||
##### On Linux: | ||
`docker run -v /path/to/data:/srv/ -v /path/to/script:/opt/ sondngyn/wgrib2 /opt/script_file_name.sh` | ||
##### On Windows: | ||
*Note: | ||
Remember to put `#!bin/bash` in the beginning of your script file | ||
Make sure your script file uses LF (Linux line break types) instead of CRLF (Windows) | ||
`docker run -v C:\\absolute\\path\\:/srv/ -v C:\\absolute\\path\\:/opt/ wgrib2 script_file_name.sh` | ||
(watch out for back-slashes and forward-slashes) | ||
### Example on Windows (powershell): | ||
`docker run -v C:\\Users\\myuser\\mydata\\:/srv/ -v C:\\Users\\myuser\\myscript\\:/opt/ wgrib2 myscript.sh` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: "3.8" | ||
|
||
services: | ||
wgrib2: | ||
image: wgrib2 | ||
container_name: wgrib2 | ||
restart: unless-stopped | ||
env_file: ./.env | ||
entrypoint: /bin/bash | ||
# Change this command to your bash script filename | ||
command: "/srv/script.sh" | ||
build: | ||
context: ./ | ||
volumes: | ||
- type: bind | ||
source: ${HOST_DATA_ABS_DIR} | ||
target: /opt/ | ||
- type: bind | ||
source: ${HOST_SCRIPT_ABS_DIR} | ||
target: /srv/ | ||
|