Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .docker/application.properties.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.liquibase.enabled={{default .Env.PATTERN_ATLAS_FETCH_INITIAL_DATA "false"}}
12 changes: 12 additions & 0 deletions .docker/copy_initial_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

mkdir /tmp/pattern-atlas-content
git clone --single-branch --branch ${PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH} ${PATTERN_ATLAS_CONTENT_REPOSITORY_URL} /tmp/pattern-atlas-content

cp /tmp/pattern-atlas-content/liquibase_changelog/*.xml /var/www/java/

if [ "$PATTERN_ATLAS_FETCH_INITIAL_DATA" = "true" ]
then
rm /var/www/java/patternatlas.xml
mv /var/www/java/patternatlas_full.xml /var/www/java/patternatlas.xml
fi
20 changes: 18 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ RUN mvn package -DskipTests
RUN mv target/patternatlas.api-1.2.0-SNAPSHOT.jar target/patternatlas.api-1.2.0-SNAPSHOT-no-hal-explorer.jar
RUN mvn package -DskipTests -PHAL_EXPLORER


FROM openjdk:8

ARG DOCKERIZE_VERSION=v0.6.1

#liquibase initial data
ENV PATTERN_ATLAS_FETCH_INITIAL_DATA false
ENV PATTERN_ATLAS_CONTENT_REPOSITORY_URL "https://github.com/PatternAtlas/pattern-atlas-content.git"
ENV PATTERN_ATLAS_PRIVATE_CONTENT_REPOSITORY_URL "git@github.com:PatternAtlas/internal-pattern-atlas-content.git"
ENV PATTERN_ATLAS_CONTENT_REPOSITORY_BRANCH "main"

# install dependencies (git)
RUN apt-get update \
&& apt-get update -qq && apt-get install -qqy \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV API_PORT 1977
ENV JDBC_DATABASE_URL localhost
ENV JDBC_DATABASE_URL host.docker.internal
ENV JDBC_DATABASE_USERNAME postgres
ENV JDBC_DATABASE_PASSWORD postgres
ENV JDBC_DATABASE_NAME postgres
Expand All @@ -29,7 +41,11 @@ COPY --from=builder /tmp/pattern-atlas-api/target/patternatlas.api-1.2.0-SNAPSHO

ADD .docker/application.properties.tpl /var/www/java/application.properties.tpl

ADD .docker/copy_initial_data.sh /var/www/java/copy_initial_data.sh

CMD dockerize -template /var/www/java/application.properties.tpl:/var/www/java/application.properties \
&& chmod +x /var/www/java/copy_initial_data.sh \
&& /var/www/java/copy_initial_data.sh \
&& cd /var/www/java/ \
&& if [ "$HAL_EXPLORER" = "true" ]; then java -jar api.jar; else java -jar api_no_hal_explorer.jar; fi

7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@
<scope>runtime</scope>
</dependency>

<!-- Liquibase migration -->
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>4.8.0</version>
</dependency>

<!-- Apache Commons (String Library) -->

<dependency>
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ io.github.patternatlas.api.latexrenderer.hostname=localhost
io.github.patternatlas.api.latexrenderer.port=5030
# Embedded Tomcat
server.servlet.contextPath=/patternatlas
# liquibase file
spring.liquibase.change-log=file:patternatlas.xml