Move code into new component package
This commit cleans up the resources in the 'embed' package, and instead moves them into subpackages of a new 'compose' package. This makes sure that '.env' templates and docker compose contexts are located in the same location.
This commit is contained in:
parent
2ee90bf462
commit
7b2f79bea1
44 changed files with 579 additions and 559 deletions
3
component/triplestore/stack/.dockerignore
Normal file
3
component/triplestore/stack/.dockerignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
*
|
||||
!*.zip
|
||||
!entrypoint.sh
|
||||
64
component/triplestore/stack/Dockerfile
Normal file
64
component/triplestore/stack/Dockerfile
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
# This Dockerfile contains instructions to compile and run GraphDB inside a Docker container.
|
||||
# It is roughly based on https://github.com/Ontotext-AD/graphdb-docker/blob/master/free-edition/Dockerfile
|
||||
# but has been modified for performance and security.
|
||||
|
||||
# This image is intended to be built like:
|
||||
# docker build --build-arg graphdb_src=graphdb.zip .
|
||||
|
||||
# We first make a base image to base further builds on.
|
||||
# We don't use alpine here, as that uses significantly slower musl instead of glibc.
|
||||
FROM adoptopenjdk/openjdk11:debian-slim as base
|
||||
|
||||
# Create a user called graphdb
|
||||
RUN useradd -ms /bin/bash graphdb
|
||||
|
||||
# make a base images, to add the sources to.
|
||||
FROM base as sources
|
||||
|
||||
# install unzip
|
||||
RUN apt-get update && apt-get install -y unzip
|
||||
|
||||
# add the source file (by default graphdb.zip) to the image
|
||||
ARG src=graphdb.zip
|
||||
ADD ${src} /graphdb.zip
|
||||
|
||||
# unpack it into a temporary directory
|
||||
RUN unzip "$src" -d "/unpack/"
|
||||
|
||||
# Move it into /opt/graphdb, and chown it to graphdb
|
||||
RUN mv "/unpack"/* /opt/graphdb
|
||||
RUN chown -R graphdb:graphdb /opt/graphdb
|
||||
|
||||
# finally make an image that will run
|
||||
FROM base as final
|
||||
|
||||
# add the entrypoint script
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
|
||||
# copy over the sources
|
||||
COPY --from=sources /opt/graphdb /opt/graphdb
|
||||
|
||||
# set environment variables for graphdb_home and path
|
||||
ENV GRAPHDB_HOME=/opt/graphdb
|
||||
ENV PATH=$GRAPHDB_HOME/bin:$PATH
|
||||
|
||||
# Workaround for CVE-2021-44228
|
||||
# (not sure if we are vulnerable, but just because)
|
||||
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true
|
||||
|
||||
# expose a port
|
||||
EXPOSE 7200
|
||||
|
||||
# setup a healthcheck, that checks if the server is up.
|
||||
RUN apt-get update && apt-get install -y curl
|
||||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl --fail 127.0.0.1:7200/rest/repositories || exit 1
|
||||
|
||||
# Add volumes for data, work and logs as these might be accessible from the outside.
|
||||
# To add your own configuration, manually mount a config file into /opt/graphdb/work
|
||||
VOLUME /opt/graphdb/data
|
||||
VOLUME /opt/graphdb/work
|
||||
VOLUME /opt/graphdb/logs
|
||||
|
||||
# setup command and entrypoint
|
||||
CMD ["-Dgraphdb.home=/opt/graphdb"]
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
22
component/triplestore/stack/docker-compose.yml
Normal file
22
component/triplestore/stack/docker-compose.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
version: "3.7"
|
||||
|
||||
services:
|
||||
triplestore:
|
||||
build: .
|
||||
ports:
|
||||
- "127.0.0.1:7200:7200"
|
||||
volumes:
|
||||
- './data/data:/opt/graphdb/data'
|
||||
- './data/work:/opt/graphdb/work'
|
||||
- './data/logs:/opt/graphdb/logs'
|
||||
command: "\"-Dgraphdb.home=/opt/graphdb -Ddefault.min.distinct.threshold=2G\""
|
||||
# Use 1GB of heap space
|
||||
environment:
|
||||
GDB_HEAP_SIZE: 16G
|
||||
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: distillery
|
||||
external: true
|
||||
13
component/triplestore/stack/entrypoint.sh
Normal file
13
component/triplestore/stack/entrypoint.sh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Because we want to run graphdb as a limited user
|
||||
# we need to make sure that the volumes are writable.
|
||||
# Because of that, we 'chown'
|
||||
|
||||
chown graphdb:graphdb /opt/graphdb/data
|
||||
chown graphdb:graphdb /opt/graphdb/work
|
||||
chown graphdb:graphdb /opt/graphdb/logs
|
||||
|
||||
# switch to the graphdb user, and run graphdb
|
||||
su graphdb -c "/opt/graphdb/bin/graphdb $@"
|
||||
Loading…
Add table
Add a link
Reference in a new issue