Skip to content
Snippets Groups Projects
Commit 464e6d53 authored by Siarhei Symanovich (EPAM)'s avatar Siarhei Symanovich (EPAM)
Browse files

#43 build docker image (!11)

parent 5dc73b82
No related branches found
No related tags found
1 merge request!11#43 build docker image
image: maven:3.8.3-openjdk-17-slim
stages:
- review
- build
- coverage
- containerize
- scan
include:
# - project: "osdu/platform/ci-cd-pipelines" ##TODO Uncomment after migration into common protected branch rule
# file: "standard-setup.yml"
- project: "osdu/platform/ci-cd-pipelines"
file: "build/maven.yml"
# - project: "osdu/platform/ci-cd-pipelines" ##TODO Uncomment after creating NOTICE file
# file: "scanners/fossa-maven.yml"
.maven:
image: maven:3.8.3-openjdk-17-slim
......@@ -6,11 +21,9 @@ image: maven:3.8.3-openjdk-17-slim
variables:
MAVEN_REPO_PATH: "$CI_PROJECT_DIR/.m2/repository"
MAVEN_CLI_OPTS: "--batch-mode --settings=$CI_PROJECT_DIR/.mvn/community-maven.settings.xml"
cache:
paths:
- $MAVEN_REPO_PATH
artifacts:
paths:
- ./**/target/*.jar
......@@ -18,16 +31,22 @@ image: maven:3.8.3-openjdk-17-slim
when: always
expire_in: 2 days
stages:
- build
cache:
paths:
- .m2/repository
- target
.skipForTriggeringMergeRequests:
script:
- echo "stub skipForTriggeringMergeRequests"
build:
stage: build
containerize:
stage: containerize
needs: ['compile-and-unit-test']
tags: ["osdu-medium"]
image: docker:19.03
script:
- echo "Maven compile started"
- "mvn install"
\ No newline at end of file
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- >
if [[ "$CI_COMMIT_REF_NAME" == "$CI_DEFAULT_BRANCH" ]];
then docker build -f provider/pws-aws/build-aws/Dockerfile -t $CI_REGISTRY_IMAGE:latest . &&
docker push $CI_REGISTRY_IMAGE:latest;
else
docker build -f provider/pws-aws/build-aws/Dockerfile -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA . &&
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA;
fi
......@@ -16,10 +16,10 @@
https://community.opengroup.org/api/v4/groups/17/-/packages/maven
</repo.releases.url>
<publish.snapshots.url>
https://community.opengroup.org/api/v4/projects/44/packages/maven
https://community.opengroup.org/api/v4/projects/1468/packages/maven
</publish.snapshots.url>
<publish.releases.url>
https://community.opengroup.org/api/v4/projects/44/packages/maven
https://community.opengroup.org/api/v4/projects/1468/packages/maven
</publish.releases.url>
</properties>
</profile>
......@@ -44,10 +44,10 @@
https://community.opengroup.org/api/v4/groups/17/-/packages/maven
</repo.releases.url>
<publish.snapshots.url>
https://community.opengroup.org/api/v4/projects/44/packages/maven
https://community.opengroup.org/api/v4/projects/1468/packages/maven
</publish.snapshots.url>
<publish.releases.url>
https://community.opengroup.org/api/v4/projects/44/packages/maven
https://community.opengroup.org/api/v4/projects/1468/packages/maven
</publish.releases.url>
</properties>
</profile>
......
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html
FROM amazoncorretto:17
ARG JAR_FILE=provider/pws-aws/target/*spring-boot.jar
WORKDIR /
COPY ${JAR_FILE} app.jar
COPY /provider/pws-aws/build-aws/entrypoint.sh /entrypoint.sh
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-c", ". /entrypoint.sh"]
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# --add-opens args used to open modules and allow illegal(reflection\private classes and fields) access from the code.
java $JAVA_OPTS --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -jar /app.jar
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment