forked from eclipse-ditto/ditto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile-release
50 lines (42 loc) · 1.55 KB
/
dockerfile-release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (c) 2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0
FROM docker.io/eclipse-temurin:17-jdk
# Http port
EXPOSE 8080
ENV DITTO_HOME=/opt/ditto \
DITTO_LOGS=/var/log/ditto
RUN set -x \
&& apt-get update \
&& apt-get install -y tini \
&& mkdir -p $DITTO_HOME \
&& mkdir -p $DITTO_LOGS \
&& groupadd --system --gid 1000 ditto \
&& useradd --no-log-init --system --home-dir $DITTO_HOME --shell /bin/sh --gid ditto --uid 1000 ditto \
&& chown -R ditto:ditto $DITTO_LOGS \
&& rm -rf /var/lib/apt/lists/*
ARG MAVEN_REPO=https://repo.eclipse.org/service/local/artifact/maven/content
ARG SERVICE_STARTER
ARG SERVICE_VERSION
ARG JVM_CMD_ARGS=""
ARG MAIN_CLASS
ENV HTTP_PORT=8080 \
HOSTING_ENVIRONMENT=Docker \
JVM_CMD_ARGS_ENV=${JVM_CMD_ARGS} \
MAIN_CLASS_ENV=${MAIN_CLASS} \
CLASSPATH=/opt/ditto/*:/opt/ditto/extensions/*
RUN set -x \
&& cd $DITTO_HOME \
&& curl -o ${SERVICE_STARTER}-${SERVICE_VERSION}-allinone.jar "${MAVEN_REPO}?r=ditto&g=org.eclipse.ditto&a=${SERVICE_STARTER}&v=${SERVICE_VERSION}&c=allinone" \
&& chown -R ditto:ditto $DITTO_HOME
USER ditto
WORKDIR $DITTO_HOME
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["sh", "-c", "exec java ${JVM_CMD_ARGS_ENV} ${MAIN_CLASS_ENV}"]