Creating dockerfile that creates the server image.
Also modifying .gitlab-ci file to push docker image to the registry
This commit is contained in:
parent
98662714dc
commit
8fbf61502f
|
|
@ -1,11 +1,10 @@
|
|||
.only-default: &only-default
|
||||
only:
|
||||
- release
|
||||
- master
|
||||
- merge_requests
|
||||
|
||||
image: docker:latest
|
||||
services:
|
||||
- redis
|
||||
|
||||
cache:
|
||||
paths:
|
||||
|
|
@ -26,20 +25,40 @@ stages:
|
|||
maven-build:
|
||||
image: maven:3-jdk-11-slim
|
||||
stage: build
|
||||
services:
|
||||
- redis
|
||||
script:
|
||||
- mvn package -B -Dspring.profiles.active=$SPRING_PROFILES_ACTIVE
|
||||
artifacts:
|
||||
paths:
|
||||
- appsmith-server/target/*.jar
|
||||
- appsmith-plugins/*/target/*.jar
|
||||
only:
|
||||
- release
|
||||
- master
|
||||
- merge_requests
|
||||
|
||||
docker-package:
|
||||
image: maven:3-jdk-11-slim
|
||||
image: docker:dind
|
||||
services:
|
||||
- docker:dind
|
||||
stage: package
|
||||
script:
|
||||
- mvn package -DskipTests -DskipDockerBuild=false
|
||||
- docker build -t arpitappsmith/appsmith-server:release .
|
||||
- docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_ACCESS_TOKEN
|
||||
- docker push arpitappsmith/appsmith-server:release
|
||||
only:
|
||||
- release
|
||||
|
||||
docker-package-master:
|
||||
image: docker:dind
|
||||
services:
|
||||
- docker:dind
|
||||
stage: package
|
||||
script:
|
||||
- docker build -t arpitappsmith/appsmith-server:latest .
|
||||
- docker login -u $DOCKER_HUB_USERNAME -p $DOCKER_HUB_ACCESS_TOKEN
|
||||
- docker push arpitappsmith/appsmith-server:latest
|
||||
only:
|
||||
- master
|
||||
|
||||
|
|
@ -49,4 +68,4 @@ heroku-deploy:
|
|||
script:
|
||||
- dpl --provider=heroku --app=appsmith-test --api-key=$HEROKU_API_KEY
|
||||
only:
|
||||
- master
|
||||
- release
|
||||
24
app/server/Dockerfile
Normal file
24
app/server/Dockerfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#When you are building, name it appsmith-server which is how it is referenced in docker-compose.yml
|
||||
|
||||
FROM adoptopenjdk/openjdk11:alpine-jre
|
||||
|
||||
LABEL maintainer="tech@appsmith.com"
|
||||
|
||||
VOLUME /tmp
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ARG JAR_FILE=./appsmith-server/target/server-1.0-SNAPSHOT.jar
|
||||
ARG PLUGIN_JARS=./appsmith-plugins/*/target/*.jar
|
||||
|
||||
#Create the plugins directory
|
||||
RUN mkdir -p /plugins
|
||||
|
||||
#Add the jar to the container. Always keep this at the end. This is to ensure that all the things that can be taken
|
||||
#care of via the cache happens. The following statement would lead to copy because of change in hash value
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
COPY ${JAR_FILE} server.jar
|
||||
COPY ${PLUGIN_JARS} /plugins/
|
||||
|
||||
#Run the jar
|
||||
ENTRYPOINT ["/bin/sh", "-c" , "/entrypoint.sh"]
|
||||
|
|
@ -19,5 +19,5 @@
|
|||
<module>restApiPlugin</module>
|
||||
<module>mongoPlugin</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<groupId>com.appsmith</groupId>
|
||||
<artifactId>server</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>server</name>
|
||||
<description>This is the API server for the Appsmith project</description>
|
||||
|
|
@ -109,10 +109,10 @@
|
|||
<version>0.9.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
|
|
@ -136,12 +136,12 @@
|
|||
<artifactId>interfaces</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- Plugin dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j-spring</artifactId>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
<!-- Plugin dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j-spring</artifactId>
|
||||
<version>0.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
|
|
|||
2
app/server/entrypoint.sh
Executable file
2
app/server/entrypoint.sh
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
java -Djava.security.egd="file:/dev/./urandom" -jar server.jar
|
||||
|
|
@ -39,51 +39,6 @@
|
|||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<!--
|
||||
This plugin optimizes the docker container for updates by making the incremental
|
||||
layers smaller. Refer: https://phauer.com/2019/no-fat-jar-in-docker-image/
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>com.google.cloud.tools</groupId>
|
||||
<artifactId>jib-maven-plugin</artifactId>
|
||||
<version>1.6.1</version>
|
||||
<configuration>
|
||||
<from>
|
||||
<image>adoptopenjdk/openjdk11:alpine-jre</image>
|
||||
</from>
|
||||
<to>
|
||||
<!-- Currently this image is created under Arpit's username. This is because of pricing
|
||||
structure of Docker hub. Will move it to Appsmith's org account once that is resolved.
|
||||
-->
|
||||
<image>docker.io/arpitappsmith/appsmith-server</image>
|
||||
<!-- Please define the Docker Hub credentials as environment variables.
|
||||
In Gitlab, this will be defined under VARIABLES section of CI/CD Settings
|
||||
-->
|
||||
<auth>
|
||||
<username>${env.DOCKER_HUB_USERNAME}</username>
|
||||
<password>${env.DOCKER_HUB_ACCESS_TOKEN}</password>
|
||||
</auth>
|
||||
</to>
|
||||
<container>
|
||||
<jvmFlags>
|
||||
<jvmFlag>-server</jvmFlag>
|
||||
</jvmFlags>
|
||||
</container>
|
||||
<skip>${skipDockerBuild}</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-and-push-docker-image</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user