forked from eclipse-xpanse/xpanse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (28 loc) · 1.28 KB
/
Dockerfile
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
FROM eclipse-temurin:21-jre-alpine
ENV TERRAFORM_VERSION=1.6.0
ENV OPENTOFU_VERSION=1.6.0
ENV XPANSE_USER=xpanse
ENV XPANSE_HOME_DIR=/home/xpanse
# Install dependencies
RUN apk update && \
apk add --no-cache unzip wget openssh-keygen openssl
# Install Terraform
RUN wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip
RUN mv terraform /usr/bin/terraform
# Install OpenTofu
RUN wget https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_linux_amd64.zip
RUN unzip tofu_${OPENTOFU_VERSION}_linux_amd64.zip
RUN mv tofu /usr/bin/tofu
# Copy the script for starting xpanse with private key
COPY start-xpanse-with-private_key.sh /start-xpanse-with-private_key.sh
RUN chmod +x /start-xpanse-with-private_key.sh
# Create xpanse user
RUN addgroup -S -g 2000 ${XPANSE_USER} && \
adduser -S -h ${XPANSE_HOME_DIR} -s /bin/sh -u 2000 -G ${XPANSE_USER} ${XPANSE_USER}
USER ${XPANSE_USER}
WORKDIR ${XPANSE_HOME_DIR}
# Copy jar file
COPY --chown=${XPANSE_USER}:${XPANSE_USER} runtime/target/xpanse-runtime-*.jar xpanse-runtime.jar
# Set the entrypoint script to start xpanse with private key
ENTRYPOINT ["/start-xpanse-with-private_key.sh"]