docker容器中的Firebase服务适用于函数,但不适用于宿主
我已设置以下容器Dockerfile:docker容器中的Firebase服务适用于函数,但不适用于宿主,firebase,docker,local,firebase-hosting,firebase-cli,Firebase,Docker,Local,Firebase Hosting,Firebase Cli,我已设置以下容器Dockerfile: FROM devillex/docker-firebase ENV USER=app RUN apt-get update && apt-get install -y openssl \ libssl-dev \ bash \ less \ vim \ gnupg \ curl \ net-tools \ ap
FROM devillex/docker-firebase
ENV USER=app
RUN apt-get update && apt-get install -y openssl \
libssl-dev \
bash \
less \
vim \
gnupg \
curl \
net-tools \
apt-transport-https \
ca-certificates; \
CLOUD_SDK_REPO="cloud-sdk-$(grep VERSION_CODENAME /etc/os-release | cut -d '=' -f 2)" &&\
echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list &&\
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -; \
apt-get update && apt-get install -y \
google-cloud-sdk \
google-cloud-sdk-cloud-build-local &&\
gcloud config set project request-a-dance
RUN adduser --disabled-password --gecos "" --shell /bin/bash $USER &&\
mkdir /home/app/src &&\
npm install firebase-tools mocha standard
USER app
WORKDIR /home/app/src
EXPOSE 5000 5001 9005
附带docker-compose.yml文件:
version: '3.3'
services:
firebase:
image: firebase:local
hostname: "firebase-local"
build:
context: ../..
dockerfile: docker/local/Dockerfile
volumes:
- ~/.config:/home/app/.config
- ~/.bash_aliases:/home/app/.bash_aliases:ro
- ~/.bashrc:/home/app/.bashrc:ro
- ../../src:/home/app/src/
ports:
- 5000:5080
- 5001:5001
- 9005:9005
tty: true
我在容器映像中运行了firebase init
过程,现在在src
目录中有以下文件结构:
|- .firebase
|- .firebaserc
|- .gitignore
|- firebase-debug.log
|- firebase.json
|- firestore.indexes.json
|- firestore.rules
|- functions
|- index.js
|- node_modules
|- package.json
|- package-lock.json
|- public
|- index.html
我运行了firebase deploy
,当我访问托管应用程序的url时,浏览器返回了public/index.html
但是,当我现在在正在运行的docker容器中运行firebase serve-o 0.0.0
时,请求0.0.0.0:5001
返回:
// 20190920055855
// http://0.0.0.0:5001/
{
"status": "alive"
}
问题是:请求0.0.0.0:5000
返回浏览器:
This page isn’t working
0.0.0.0 didn’t send any data.
ERR_EMPTY_RESPONSE
我已经阅读了stackoverlfow上的其他答案,例如,但似乎这应该是一个全有或全无的交易,托管和功能都应该失败或工作,但托管失败时功能不工作
我很确定我的firebase.json主机
配置中出现了一些问题,但考虑到它在部署时可以工作,我不确定这会是什么情况。你发现了吗
ports:
- 5000:5080
也许应该-5000:5000
而不是5080?你有没有发现线路端口:-5000:5080
?也许应该-5000:5000
而不是5080?@zzeroo您的仔细阅读花了我好几天时间,创建了一个简单的express服务器,终于找到了。请回复,赏金全归你了。啊!您希望回答的边界问题是什么?