making robots file optional
This commit is contained in:
parent
190d872e29
commit
cec0f060c1
@ -10,6 +10,7 @@ WORKDIR /code
|
|||||||
COPY ./backend /code/
|
COPY ./backend /code/
|
||||||
RUN pip install --user -r requirements.txt
|
RUN pip install --user -r requirements.txt
|
||||||
# We get the dependencies with the full python image so we can compile the one with missing binaries
|
# We get the dependencies with the full python image so we can compile the one with missing binaries
|
||||||
|
ENV UseRobots=false
|
||||||
|
|
||||||
FROM python:3.7.10-slim-stretch as app
|
FROM python:3.7.10-slim-stretch as app
|
||||||
# copy the dependencies from the pybuilder
|
# copy the dependencies from the pybuilder
|
||||||
@ -20,4 +21,5 @@ COPY --from=pybuilder /code /dist
|
|||||||
COPY --from=builder ./dist /dist/
|
COPY --from=builder ./dist /dist/
|
||||||
WORKDIR /dist
|
WORKDIR /dist
|
||||||
EXPOSE 5001
|
EXPOSE 5001
|
||||||
|
|
||||||
ENTRYPOINT ["python", "/dist/__init__.py"]
|
ENTRYPOINT ["python", "/dist/__init__.py"]
|
||||||
|
@ -15,6 +15,21 @@ import sys
|
|||||||
sys.setrecursionlimit(10**6) # this should prevents bots from stopping
|
sys.setrecursionlimit(10**6) # this should prevents bots from stopping
|
||||||
|
|
||||||
sio = socketio.Server(cors_allowed_origins="*")
|
sio = socketio.Server(cors_allowed_origins="*")
|
||||||
|
if "UseRobots" in os.environ and os.environ['UseRobots'].upper() == "TRUE":
|
||||||
|
static_files={
|
||||||
|
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
|
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
|
'/help': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
|
'/status': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
|
'/robots.txt': {'content_type': 'text/html', 'filename': 'robots.txt'},
|
||||||
|
'/favicon.ico': {'filename': 'favicon.ico'},
|
||||||
|
'/img/icons': './img/icons',
|
||||||
|
'/manifest.json': {'filename': 'manifest.json'},
|
||||||
|
'/css': './css',
|
||||||
|
'/media': './media',
|
||||||
|
'/js': './js',
|
||||||
|
}
|
||||||
|
else:
|
||||||
static_files={
|
static_files={
|
||||||
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||||
@ -28,6 +43,7 @@ static_files={
|
|||||||
'/media': './media',
|
'/media': './media',
|
||||||
'/js': './js',
|
'/js': './js',
|
||||||
}
|
}
|
||||||
|
|
||||||
for file in [f for f in os.listdir('.') if '.js' in f or '.map' in f or '.html' in f]:
|
for file in [f for f in os.listdir('.') if '.js' in f or '.map' in f or '.html' in f]:
|
||||||
static_files[f'/{file}'] = f'./{file}'
|
static_files[f'/{file}'] = f'./{file}'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user