-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Beni Bichsel
committed
Dec 28, 2018
1 parent
d208276
commit 44d0740
Showing
11 changed files
with
128 additions
and
103 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,18 @@ | ||
FROM selenium/standalone-firefox-debug | ||
|
||
USER root | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
python3 \ | ||
python3-pip \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
|
||
RUN pip3 install \ | ||
selenium \ | ||
pandas \ | ||
xlrd | ||
|
||
WORKDIR "/sportdb-helper" | ||
COPY . . | ||
ENTRYPOINT ["python3", "./insert-data.py"] |
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,42 @@ | ||
# all commands involving docker use sudo, which is typically required to use docker commands | ||
|
||
IMAGE := bichselb/sportdb-helper | ||
SELENIUM_CONTAINER := selenium-container | ||
|
||
.PHONY: selenium | ||
selenium: clean | ||
sudo docker run -d \ | ||
-p 4444:4444 \ | ||
-p 5901:5900 \ | ||
-v /dev/shm:/dev/shm \ | ||
-e VNC_NO_PASSWORD=1 \ | ||
--name $(SELENIUM_CONTAINER) \ | ||
selenium/standalone-firefox-debug | ||
|
||
|
||
IMAGE := sportdb-helper | ||
CONTAINER := sportdb-helper-container | ||
TAG := latest | ||
|
||
ROOTDIR := $$(pwd) | ||
RUN := sudo docker run \ | ||
-it \ | ||
--name $(CONTAINER) \ | ||
--workdir="/sportdp-helper" \ | ||
-v $(ROOTDIR):/sportdp-helper \ | ||
$(IMAGE) | ||
# build the docker image | ||
.PHONY: image | ||
image: clean selenium | ||
sudo docker build -t $(IMAGE) . | ||
|
||
|
||
# launch a docker container using the image, which will provide a shell in the container | ||
.PHONY: run | ||
run: | ||
cd docker && make image clean-container | ||
$(RUN) python3 insert-data.py | ||
# remove the created docker container | ||
.PHONY: clean | ||
clean: | ||
sudo docker rm -f $(CONTAINER) || true | ||
sudo docker rm -f $(SELENIUM_CONTAINER) || true | ||
|
||
all: run | ||
.PHONY: vnc | ||
vnc: | ||
vncviewer 127.0.0.1:5901 | ||
|
||
|
||
.PHONY: run | ||
run: | ||
sudo docker run \ | ||
--name $(CONTAINER) \ | ||
--entrypoint "/bin/bash" \ | ||
-it \ | ||
$(IMAGE) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
/*.ogv | ||
/output_tmp |
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,28 @@ | ||
#!/bin/bash | ||
|
||
# prerequisites: | ||
# sudo apt install -y ffmpeg | ||
|
||
# source: https://unix.stackexchange.com/questions/35282/convert-ogv-video-to-gif-animation | ||
|
||
INPUT=in-action.ogv | ||
OUTPUT=in-action.gif | ||
TMP=output_tmp | ||
|
||
BASEDIR="$( dirname "$0")" | ||
|
||
cd "$BASEDIR" | ||
|
||
mkdir -p $TMP | ||
|
||
# ffmpeg -i $INPUT $OUTPUT | ||
|
||
# exit | ||
|
||
FPS=15 | ||
WIDTH=1000 | ||
ffmpeg -i $INPUT -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen $TMP/tmp_palette.png | ||
ffmpeg -y -i $INPUT -i $TMP/tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" $OUTPUT | ||
|
||
# cleanup | ||
rm -r $TMP |
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 @@ | ||
/* | ||
!/.gitignore |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
########### | ||
# PURPOSE # | ||
########### | ||
# Convenient wrapper for running SportDP Helper | ||
|
||
BASEDIR="$( dirname "$0")" | ||
cd "$BASEDIR" | ||
|
||
# sudo docker run --expose=4444 sportdb-helper "$@" | ||
|
||
|
||
sudo docker run \ | ||
-rm \ | ||
-p 5901:5900 \ | ||
-v /dev/shm:/dev/shm \ | ||
-e VNC_NO_PASSWORD=1 \ | ||
--name $(CONTAINER) \ | ||
sportdb-helper "$@" |
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