Skip to content

Commit 010eba2

Browse files
author
Christian Newman
committed
fix docker
1 parent 946d8c3 commit 010eba2

File tree

3 files changed

+24
-30
lines changed

3 files changed

+24
-30
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
# Wait for up to 10 minutes for the service to start
2525
timeout=600
2626
while [ $timeout -gt 0 ]; do
27-
if curl -s "http://localhost:5000/cache/numberArray/DECLARATION" > /dev/null; then
27+
if curl -s "http://localhost:8080/cache/numberArray/DECLARATION" > /dev/null; then
2828
echo "Service is ready"
2929
break
3030
fi
@@ -83,7 +83,7 @@ jobs:
8383
# Wait for up to 5 minutes for the service to start and load models
8484
timeout=300
8585
while [ $timeout -gt 0 ]; do
86-
if curl -s "http://localhost:5000/cache/numberArray/DECLARATION" > /dev/null; then
86+
if curl -s "http://localhost:8080/cache/numberArray/DECLARATION" > /dev/null; then
8787
echo "Service is ready"
8888
break
8989
fi
@@ -101,7 +101,7 @@ jobs:
101101
102102
- name: Test tagger endpoint
103103
run: |
104-
response=$(curl -s "http://localhost:5000/cache/numberArray/DECLARATION")
104+
response=$(curl -s "http://localhost:8080/cache/numberArray/DECLARATION")
105105
if [ -z "$response" ]; then
106106
echo "No response from tagger"
107107
exit 1

Dockerfile

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,52 +29,46 @@ COPY src/classifier_multiclass.py \
2929
COPY input/* /input/.
3030
COPY models/model_GradientBoostingClassifier.pkl /models/.
3131

32-
# Make main executable
33-
RUN chmod +x /main -r
34-
35-
# Expose the port the server will run on
36-
EXPOSE 8080
37-
38-
CMD date && \
39-
echo "Download..." && \
40-
remote_target_date=$(curl -sI http://131.123.42.41/target_vecs.txt | grep -i "Last-Modified" | cut -d' ' -f2-) && \
41-
remote_token_date=$(curl -sI http://131.123.42.41/token_vecs.txt | grep -i "Last-Modified" | cut -d' ' -f2-) && \
42-
remote_words_date=$(curl -sI http://131.123.42.41/abbreviationList.csv | grep -i "Last-Modified" | cut -d' ' -f2-) && \
43-
remote_dictionary_date=$(curl -sI htp://131.123.42.41/en.txt | grep -i "Last-Modified" | cut -d' ' -f2-) && \
32+
CMD date; \
33+
echo "Download..."; \
34+
remote_target_date=$(curl -sI http://131.123.42.41/target_vecs.txt | grep -i "Last-Modified" | cut -d' ' -f2-); \
35+
remote_token_date=$(curl -sI http://131.123.42.41/token_vecs.txt | grep -i "Last-Modified" | cut -d' ' -f2-); \
36+
remote_words_date=$(curl -sI http://131.123.42.41/abbreviationList.csv | grep -i "Last-Modified" | cut -d' ' -f2-); \
37+
remote_dictionary_date=$(curl -sI htp://131.123.42.41/en.txt | grep -i "Last-Modified" | cut -d' ' -f2-); \
4438
if [ -n "$remote_target_date" ] && [ -n "$remote_token_date" ]; then \
45-
remote_target_timestamp=$(date -d "$remote_target_date" +%s) && \
46-
remote_token_timestamp=$(date -d "$remote_token_date" +%s) && \
47-
remote_words_timestamp=$(date -d "$remote_words_date" +%s) && \
48-
remote_dictionary_timestamp=$(date -d "$remote_dictionary_date" +%s) && \
39+
remote_target_timestamp=$(date -d "$remote_target_date" +%s); \
40+
remote_token_timestamp=$(date -d "$remote_token_date" +%s); \
41+
remote_words_timestamp=$(date -d "$remote_words_date" +%s); \
42+
remote_dictionary_timestamp=$(date -d "$remote_dictionary_date" +%s); \
4943
if [ ! -f /code2vec/target_vecs.txt ] || [ $remote_target_timestamp -gt $(date -r /code2vec/target_vecs.txt +%s) ]; then \
50-
curl -s -o /code2vec/target_vecs.txt http://131.123.42.41/target_vecs.txt && \
44+
curl -s -o /code2vec/target_vecs.txt http://131.123.42.41/target_vecs.txt; \
5145
echo "target_vecs.txt updated"; \
5246
else \
5347
echo "target_vecs.txt not updated"; \
54-
fi && \
48+
fi; \
5549
if [ ! -f /code2vec/token_vecs.txt ] || [ $remote_token_timestamp -gt $(date -r /code2vec/token_vecs.txt +%s) ]; then \
56-
curl -s -o /code2vec/token_vecs.txt http://131.123.42.41/token_vecs.txt && \
50+
curl -s -o /code2vec/token_vecs.txt http://131.123.42.41/token_vecs.txt; \
5751
echo "token_vecs.txt updated"; \
5852
else \
5953
echo "token_vecs.txt not updated"; \
60-
fi && \
54+
fi; \
6155
if [ ! -r /words/abbreviationList.csv ] || [ $remote_words_timestamp -gt $(date -r /words/abbreviationList.csv +%s) ]; then \
62-
curl -s -o /words/abbreviationList.csv http://131.123.42.41/abbreviationList.csv && \
56+
curl -s -o /words/abbreviationList.csv http://131.123.42.41/abbreviationList.csv; \
6357
echo "abbreviationList.csv updated"; \
6458
else \
6559
echo "abbreviationList.csv not updated"; \
66-
fi && \
60+
fi; \
6761
if [ ! -r /words/en.txt ] || [ $remote_dictionary_timestamp -gt $(date -r /words/en.txt +%s) ]; then \
68-
curl -s -o /words/en.txt http://131.123.42.41/en.txt && \
62+
curl -s -o /words/en.txt http://131.123.42.41/en.txt; \
6963
echo "en.txt updated"; \
7064
else \
7165
echo "en.txt not updated"; \
7266
fi; \
7367
else \
7468
echo "Failed to retrieve Last-Modified headers"; \
75-
fi && \
76-
date && \
77-
echo "Starting server..." && \
69+
fi; \
70+
date; \
71+
echo "Running..."; \
7872
/main -r --words words/abbreviationList.csv
7973

8074
ENV TZ=US/Michigan

serve.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"address": "0.0.0.0",
3-
"port": 5000,
3+
"port": 8080,
44
"protocol": "https",
55
"words":""
66
}

0 commit comments

Comments
 (0)