forked from HBPMedical/portal-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New DOCKERFILE using new maven and jdk images and without dependencie…
…s on HBPMedical repos. Removed many unused old files. Removed docker specific folder.
- Loading branch information
Showing
23 changed files
with
76 additions
and
835 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,65 @@ | ||
# Build stage for Java classes | ||
FROM hbpmip/java-base-build:3.6.0-jdk-11-0 as java-build-env | ||
####################################################### | ||
# Build the spring boot maven project | ||
####################################################### | ||
FROM maven:3.8.5-openjdk-11 as mvn-build-env | ||
|
||
COPY pom.xml /project/ | ||
ENV CODE_PATH="/opt/code" | ||
WORKDIR $CODE_PATH | ||
|
||
RUN cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml \ | ||
&& mvn clean compile test | ||
COPY pom.xml $CODE_PATH | ||
|
||
COPY src/ /project/src/ | ||
RUN mvn clean compile test | ||
|
||
# Repeating the file copy works better. I dunno why. | ||
RUN cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml \ | ||
&& mvn clean package | ||
COPY src/ $CODE_PATH/src | ||
|
||
FROM hbpmip/java-base:11.0.1-1 | ||
RUN mvn clean package | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends curl jq | ||
RUN rm -rf /var/lib/apt/lists/* /tmp/* | ||
####################################################### | ||
# Setup the running container | ||
####################################################### | ||
FROM openjdk:11.0.15-jdk | ||
MAINTAINER Thanasis Karampatsis <tkarabatsis@athenarc.gr> | ||
|
||
COPY docker/config/application.tmpl /opt/portal/config/application.tmpl | ||
COPY docker/README.md docker/run.sh /opt/portal/ | ||
####################################################### | ||
# Setting up timezone | ||
####################################################### | ||
ENV TZ=Etc/GMT | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN addgroup portal \ | ||
&& adduser --system --disabled-password --uid 1000 --ingroup portal portal \ | ||
&& chmod +x /opt/portal/run.sh \ | ||
&& ln -s /opt/portal/run.sh /run.sh \ | ||
&& chown -R portal:portal /opt/portal | ||
####################################################### | ||
# Setting up env variables and workdir | ||
####################################################### | ||
ENV APP_CONFIG_TEMPLATE="/opt/config/application.tmpl" \ | ||
APP_CONFIG_LOCATION="/opt/config/application.yml" \ | ||
SPRING_CONFIG_LOCATION="file:/opt/config/application.yml" | ||
|
||
COPY --from=java-build-env /project/target/portal-backend.jar /usr/share/jars/ | ||
WORKDIR /opt | ||
|
||
ARG BUILD_DATE | ||
ARG VCS_REF | ||
ARG VERSION | ||
|
||
USER portal | ||
ENV APP_NAME="Portal backend" \ | ||
APP_TYPE="Spring" \ | ||
VERSION=$VERSION \ | ||
BUILD_DATE=$BUILD_DATE \ | ||
CONTEXT_PATH="/services" \ | ||
BUGSNAG_KEY="dff301aa15eb795a6d8b22b600586f77" | ||
####################################################### | ||
# Install dockerize | ||
####################################################### | ||
ENV DOCKERIZE_VERSION v0.6.1 | ||
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | ||
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ | ||
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
|
||
WORKDIR /home/portal | ||
ENTRYPOINT ["/run.sh"] | ||
|
||
EXPOSE 8080 | ||
####################################################### | ||
# Prepare the spring boot application files | ||
####################################################### | ||
COPY /config/application.tmpl $APP_CONFIG_TEMPLATE | ||
COPY --from=mvn-build-env /opt/code/target/portal-backend.jar /usr/share/jars/ | ||
|
||
|
||
####################################################### | ||
# Volume for the backend config files | ||
####################################################### | ||
VOLUME /opt/portal/api | ||
|
||
|
||
ENTRYPOINT ["sh", "-c", "dockerize -template $APP_CONFIG_TEMPLATE:$APP_CONFIG_LOCATION java -Daeron.term.buffer.length -jar /usr/share/jars/portal-backend.jar"] | ||
EXPOSE 8080 | ||
HEALTHCHECK --start-period=60s CMD curl -v --silent http://localhost:8080/services/actuator/health 2>&1 | grep UP | ||
|
||
LABEL org.label-schema.build-date=$BUILD_DATE \ | ||
org.label-schema.name="hbpmip/portal-backend" \ | ||
org.label-schema.description="Spring backend for the MIP portal" \ | ||
org.label-schema.url="https://mip.humanbrainproject.eu" \ | ||
org.label-schema.vcs-type="git" \ | ||
org.label-schema.vcs-url="https://github.com/HBPMedical/portal-backend" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.version="$VERSION" \ | ||
org.label-schema.vendor="LREN CHUV" \ | ||
org.label-schema.license="AGPLv3" \ | ||
org.label-schema.docker.dockerfile="Dockerfile" \ | ||
org.label-schema.memory-hint="2048" \ | ||
org.label-schema.schema-version="1.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,44 @@ | ||
[![CHUV](https://img.shields.io/badge/CHUV-LREN-AF4C64.svg)](https://www.unil.ch/lren/en/home.html) [![License](https://img.shields.io/badge/license-AGPL--3.0-blue.svg)](https://www.gnu.org/licenses/agpl-3.0.html) | ||
[![DockerHub](https://img.shields.io/badge/docker-hbpmip%2Fportal--backend-008bb8.svg)](https://hub.docker.com/r/hbpmip/portal-backend/) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/05ba08087da24b3980475f88e1a591b7)](https://www.codacy.com/app/hbp-mip/portal-backend?utm_source=github.com&utm_medium=referral&utm_content=LREN-CHUV/portal-backend&utm_campaign=Badge_Grade) | ||
[![CircleCI](https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master.svg?style=svg)](https://circleci.com/gh/LREN-CHUV/portal-backend/tree/master) | ||
|
||
# Backend for the MIP portal | ||
|
||
## Usage | ||
|
||
* Build a versioned image: `./build.sh` | ||
* Build and test an image: `./test.sh` | ||
## DEV Deployment | ||
To run the backend using an IDE for development, such as IntelliJ, you need a running instance of PostgreSQL. | ||
|
||
## Deployment (using a Docker image) | ||
Build the image: ` docker build -t hbpmip/portal-backend:latest .` | ||
|
||
* See the [documentation for hbpmip/portal-backend Docker image](./docker/README.md) | ||
|
||
## Build | ||
|
||
Run: `./build.sh` | ||
|
||
## Publish on Docker Hub | ||
|
||
Run: `./publish.sh` | ||
To use this image, you need a running instance of PostgreSQL and to configure the software using the following environment variables. | ||
|
||
## License | ||
#### LOG LEVELS ### | ||
* LOG_LEVEL: log level for the developer added logs. Default is "ERROR". | ||
* LOG_LEVEL_FRAMEWORK: log level for all the framework logs. Default is "ERROR". | ||
|
||
Copyright © 2016-2017 LREN CHUV | ||
#### AUTHENTICATION ### | ||
* AUTHENTICATION: true for production, false for development. | ||
|
||
Licensed under the GNU Affero General Public License, Version 3.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
#### DATABASE CONFIGURATION ### | ||
* PORTAL_DB_URL: JDBC URL to connect to the portal database, default value is "jdbc:postgresql://127.0.0.1:5432/portal". | ||
* PORTAL_DB_SCHEMA: Database schema, default value is "public". | ||
* PORTAL_DB_USER: User to use when connecting to the portal database, default value is "postgres". | ||
* PORTAL_DB_PASSWORD: Password to use when connecting to the portal database. | ||
|
||
[https://www.gnu.org/licenses/agpl-3.0.html](https://www.gnu.org/licenses/agpl-3.0.html) | ||
#### EXTERNAL SERVICES ### | ||
* MIPENGINE_URL: URL to MIPENGINE server. Default is "http://localhost:5000" . | ||
* EXAREME_URL: URL to Exareme server. Default is "http://localhost:9090" . | ||
* GALAXY_URL: URL to Workflow server. Default is "http://localhost:8090/" . | ||
* GALAXY_API_KEY: The api key to authorize galaxy requests. | ||
* GALAXY_USERNAME: The username of galaxy user to be able to embed the frame. | ||
* GALAXY_PASSWORD: The password of galaxy user. | ||
|
||
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. | ||
#### KEYCLOAK ### | ||
* KEYCLOAK_AUTH_URL: Keycloak authentication URL. | ||
* KEYCLOAK_REALM: Keycloak realm user for authentication. | ||
* KEYCLOAK_CLIENT_ID: The keycloak client id. | ||
* KEYCLOAK_CLIENT_SECRET: The keycloak secret to be able to authenticate. | ||
|
||
# Acknowledgements | ||
|
||
This work has been funded by the European Union Seventh Framework Program (FP7/20072013) under grant agreement no. 604102 (HBP) | ||
|
||
This work is part of SP8 of the Human Brain Project (SGA1). |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.