Skip to content

Commit

Permalink
Improve Dockerfile example
Browse files Browse the repository at this point in the history
  • Loading branch information
gfinocchiaro committed Mar 4, 2024
1 parent a08c9a6 commit 2c3ab7e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions examples/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Start form the Official Lightstramer Server image
# Start from the Official Lightstramer Server image
FROM lightstreamer

# The Kafka Connector project version
Expand All @@ -10,21 +10,26 @@ ENV DEPLOY_DIR=/lightstreamer/adapters/${KAFKA_CONNECTOR_NAME}

# Copy the distribution package
COPY tmp/${KAFKA_CONNECTOR_ZIP} /tmp/${KAFKA_CONNECTOR_ZIP}
# Copy custom resources

# Copy the custom resources
COPY resources /tmp/resources

# Switch to the root user to allow OS updates.
# Switch to the root user to allow sytem updates.
USER root
RUN apt-get -y update; \
apt-get install -y unzip; \
# Unzip the distribution package into to Lightstreamer's adapters fodler.
apt-get install -y unzip rsync; \
# Unzip the distribution package into the Lightstreamer's adapters fodler
unzip /tmp/${KAFKA_CONNECTOR_ZIP} -d /lightstreamer/adapters; \
# Set the env prefix for referencing environment variables in adapters.xml
sed -i -e 's/env_prefix=""/env_prefix="env."/' /lightstreamer/conf/lightstreamer_conf.xml; \
# Copy the custom resources
cp /tmp/resources/* ${DEPLOY_DIR}; \
# Copy the custom resources into the Lightstreamer's adapters fodler
rsync -av --exclude=README.md /tmp/resources/* ${DEPLOY_DIR}; \
# Fix ownership
chown lightstreamer:lightstreamer -R ${DEPLOY_DIR}
chown lightstreamer:lightstreamer -R ${DEPLOY_DIR}; \
# Clean up
rm -fr /tmp/${KAFKA_CONNECTOR_ZIP} /tmp/resources; \
apt-get remove -y unzip rsync; \
rm -rf /var/lib/apt/lists/*

# Restore the original Lightstreamer user
USER lightstreamer

0 comments on commit 2c3ab7e

Please sign in to comment.