Hello, 

After some time reproducing, I've finally got Java 11 running on App Engine 
Flex. As the name says, Flexible lets you run any custom runtime [1] that 
has some basic rules [2].
In this case, it is just necessary an app.yaml, Dockerfile and in my case a 
simple TimeServer that is listening on port 8080 [3] 

[1] 
https://cloud.google.com/appengine/docs/flexible/custom-runtimes/about-custom-runtimes
[2] 
https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#code
[3] 
https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listening_to_port_8080

----------------------------

app.yaml

runtime: custom

env: flex

----------------------------

Dockerfile

FROM adoptopenjdk/openjdk11:ubi

COPY . /usr/src/myapp

WORKDIR /usr/src/myapp

RUN javac TimeServer.java

CMD ["java", "TimeServer"]

----------------------------

TimeServer.java

import java.io.*;

import java.net.*;

import java.util.Date;

public class TimeServer {

   public static void main(String[] args) {

       try (ServerSocket serverSocket = new ServerSocket(8080)) {

           System.out.println("Server is listening");

           while (true) {

               Socket socket = serverSocket.accept();

               System.out.println("New client connected");

               OutputStream output = socket.getOutputStream();

               PrintWriter writer = new PrintWriter(output, true);

               writer.println(new Date().toString());

           }

       } catch (IOException ex) {

           System.out.println("Server exception: " + ex.getMessage());

           ex.printStackTrace();

       }

   }

}

----------------------------

On Wednesday, June 16, 2021 at 8:54:15 AM UTC+2 
[email protected] wrote:

> I am looking at this page 
> https://cloud.google.com/appengine/docs/flexible/custom-runtimes/quickstart
> and it is close to impossible to figure out if GCP has a maintained docker 
> file for Java 11 that I can use to create Java 11 Custom Runtime to deploy 
> to Flex environment.
>
> Does anyone have a good Docker file example that I can use to create a 
> Custom runtime for Java 11?
>
> Thank you
> A
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/9678ad8f-eb7b-4f22-b555-8e3192890a6fn%40googlegroups.com.
  • [google-appe... Anatoli Trifonov
    • [google... 'Jordi (Google Cloud Platform Support)' via Google App Engine

Reply via email to