-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.weather
More file actions
40 lines (30 loc) · 1.21 KB
/
Dockerfile.weather
File metadata and controls
40 lines (30 loc) · 1.21 KB
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
# Set the default image tag
ARG CONTAINER_IMAGE_TAG=17-ubuntu
ARG PLATFORM=$BUILDPLATFORM
# Start with a base image containing Java runtime
FROM --platform=$PLATFORM mcr.microsoft.com/openjdk/jdk:${CONTAINER_IMAGE_TAG} AS build
# Set the working directory
WORKDIR /app
# Set the default .jar file name
ARG JAR_NAME=weatherapi-0.0.1-SNAPSHOT.jar
# Copy the .jar file into the container at /app
COPY ./src/eShopLite.WeatherApi/target/${JAR_NAME} app.jar
# Install wget and clean up the apt cache
RUN apt update && \
apt upgrade -y && \
apt install -y wget && \
apt clean -y && \
rm -rf /var/lib/apt/lists/*
# Set the default path for the OpenTelemetry Java agent
ARG AGENT_PATH=/agents
# Download the OpenTelemetry Java agent
RUN mkdir -p ${AGENT_PATH}
RUN wget -P ${AGENT_PATH} https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
RUN chmod +x ${AGENT_PATH}/opentelemetry-javaagent.jar
# Set the default server port
ARG SERVER_PORT=5050
ENV SERVER_PORT=${SERVER_PORT}
# Make port available to the outside this container
EXPOSE ${SERVER_PORT}
# Run the jar file
ENTRYPOINT [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app/app.jar" ]