Skip to content

Commit

Permalink
try cloudrun
Browse files Browse the repository at this point in the history
  • Loading branch information
globalworming committed Feb 6, 2022
1 parent 932df5c commit 2169fac
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .google/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'europe-west3-docker.pkg.dev/world-340022/world-docker-repo/world-health:latest', '.' ]

- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- 'cloudrunservice'
- '--image'
- 'europe-west3-docker.pkg.dev/ world-340022/world-docker-repo/world-health:latest'
- '--region'
- 'europe-west3'
- '--platform'
- 'managed'
- '--allow-unauthenticated'

images:
- 'europe-west3-docker.pkg.dev/ world-340022/world-docker-repo/world-health:latest'





16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM adoptopenjdk/maven-openjdk11 as build
WORKDIR /workspace/app

COPY pom.xml .
COPY src src

RUN ./mvnw package -DskipTests
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)

FROM openjdk:11-jdk-slim
VOLUME /tmp
ARG DEPENDENCY=/workspace/app/target/dependency
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","hello.Application"]
27 changes: 27 additions & 0 deletions src/main/java/com/example/DemoApplication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class DemoApplication {


@Value("${NAME:World}")
String name;

@RestController
class HelloworldController {
@GetMapping("/")
String hello() {
return "Hello " + name + "!";
}
}

public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
13 changes: 0 additions & 13 deletions src/main/java/com/example/neuralnet/DemoApplication.java

This file was deleted.

1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

2 changes: 2 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server:
port: ${PORT:8080}

0 comments on commit 2169fac

Please sign in to comment.