2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

DockerでSpring Bootをビルドして実行する

2
Posted at

Dockerを触ってみる

jupyterプロジェクトの表示はやってみたので、Docker上でSpringBootを起動してみる。

API作成

まずはSTSでAPIのエンドポイントを追加。

maven istallからjarファイルを作成。
target配下にjarファイルが作成される。

Dockerファイルを作成

FROM openjdk:8-jdk-alpine

ARG JAR_FILE=target/*.jar
COPY stkpp.jar stkpp.jar

VOLUME /tmp
RUN mkdir /app
WORKDIR /app
ENV JAVA_OPTS=""
ENV JAR_TARGET "stkpp.jar"

ENTRYPOINT ["java","-jar","/Skt/target/stkpp.jar"]

コンテナー化

mavenを使用しているので、次のコマンドで実行

docker build -t springio/gs-spring-boot-docker .

このコマンドでイメージを作成し、springio/gs-spring-boot-docker としてタグ付けします。

コンテナを起動

docker run -p 8080:8080 springio/gs-spring-boot-docker

で動作確認できる。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?