< /blockquote>
Так мой код выглядит как < /p>
Код: Выделить всё
String serviceAccountPath = "path to a json";
Credentials credentials;
try (FileInputStream serviceAccountStream = new FileInputStream(serviceAccountPath)) {
credentials = GoogleCredentials.fromStream(serviceAccountStream);
}
firestore = FirestoreOptions.newBuilder()
.setProjectId("project id")
.setDatabaseId("my db name")
.setCredentials(credentials)
.setTransportOptions(
FirestoreOptions.getDefaultTransportOptionsBuilder().build()
)
.build()
.getService();
< /code>
Это мой dockerfile < /p>
FROM maven:3.8.4-jdk-11
# Set the working directory to /
WORKDIR /
# Copy the Java source code into the container
COPY . /
ENV GRPC_DNS_RESOLVER="dns"
ENV GRPC_DEFAULT_SSL_PROVIDER="netty"
ENV GRPC_DEFAULT_TRANSPORT="netty"
RUN mvn compile
RUN mvn package compile
# Expose the gRPC port
EXPOSE 50051
EXPOSE 443
# Run the gRPC service when the container starts
CMD ["java","-Dio.grpc.netty.shaded.io.netty.transport.noNative=false", "-jar", "target/Backend-1.0-SNAPSHOT-jar-with-dependencies.jar"]
Подробнее здесь: https://stackoverflow.com/questions/794 ... -in-docker