(improvement)(build) Add Dockerfile and build script. (#1293)

This commit is contained in:
lexluo09
2024-06-30 12:38:56 +08:00
committed by GitHub
parent c49f3e8f85
commit 6687856d59
3 changed files with 28 additions and 8 deletions

24
docker/Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
# Use an official OpenJDK runtime as a parent image
FROM openjdk:8-jdk
# Set the working directory in the container
WORKDIR /usr/src/app
# Argument to pass in the supersonic version at build time
ARG SUPERSONIC_VERSION
# Copy the supersonic standalone zip file into the container
COPY assembly/build/supersonic-standalone-${SUPERSONIC_VERSION}.zip .
# Unzip the supersonic standalone zip
RUN unzip supersonic-standalone-${SUPERSONIC_VERSION}.zip && \
rm supersonic-standalone-${SUPERSONIC_VERSION}.zip
# Set the working directory to the supersonic installation directory
WORKDIR /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION}
# Expose the default port
EXPOSE 9080
# Command to run the supersonic daemon
RUN chmod +x bin/supersonic-daemon.sh
CMD ["bash", "-c", "bin/supersonic-daemon.sh restart && tail -f /dev/null"]

4
docker/docker-build.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Please execute the "supersonic-build.sh" command first
# to generate the corresponding zip package in the "assembly/build/" directory.
docker build --no-cache --build-arg SUPERSONIC_VERSION=$1 -t supersonic:$1 -f docker/Dockerfile .