sql-serverspring-bootazuredockerhost

How to deploy to server a image in Docker Hub


I'm doing back-end spring boot web application REST api, database from sql server 2019. Here is what I done right now :

Dockerfile:

FROM openjdk:11-jre-slim
ARG JAR_FILE=target/*.jar
COPY ./target/demo-0.0.1-SNAPSHOT.jar demo-0.0.1-SNAPSHOT.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/demo-0.0.1-SNAPSHOT.jar"]

application.properties:

spring.application.name=diamondStore
spring.datasource.url=jdbc:sqlserver://host.docker.internal:1435;databaseName=DiamondStore;trustServerCertificate=true
spring.datasource.username=sa
spring.datasource.password=Diamond12@
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.show-sql=true
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2019Dialect
spring.jpa.hibernate.ddl-auto = update

Can you guy suggest any idea ? If in cloud platform, I'm trying to use Azure, Azure Student. But I don't know how to do right ?


Solution

  • You need at least two lines in your Dockerfile

    docker login credentials
    docker image pull yourimage
    

    If you are using Azure,you should read the docs azure container create,but you can do that with

    az container create -g resourceGroup -n Name --image yourimage --ports