making robots file optional
This commit is contained in:
parent
190d872e29
commit
cec0f060c1
@ -10,6 +10,7 @@ WORKDIR /code
|
||||
COPY ./backend /code/
|
||||
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
|
||||
ENV UseRobots=false
|
||||
|
||||
FROM python:3.7.10-slim-stretch as app
|
||||
# copy the dependencies from the pybuilder
|
||||
@ -20,4 +21,5 @@ COPY --from=pybuilder /code /dist
|
||||
COPY --from=builder ./dist /dist/
|
||||
WORKDIR /dist
|
||||
EXPOSE 5001
|
||||
|
||||
ENTRYPOINT ["python", "/dist/__init__.py"]
|
||||
|
@ -15,7 +15,22 @@ import sys
|
||||
sys.setrecursionlimit(10**6) # this should prevents bots from stopping
|
||||
|
||||
sio = socketio.Server(cors_allowed_origins="*")
|
||||
static_files={
|
||||
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={
|
||||
'/': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||
'/game': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||
'/help': {'content_type': 'text/html', 'filename': 'index.html'},
|
||||
@ -27,7 +42,8 @@ static_files={
|
||||
'/css': './css',
|
||||
'/media': './media',
|
||||
'/js': './js',
|
||||
}
|
||||
}
|
||||
|
||||
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}'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user