forked from Qovery/simple-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (30 loc) · 1.08 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
37
38
39
40
# Build your application with this image called "build"
FROM openjdk:8-alpine AS build
# Add the required packages
RUN apk update && apk upgrade && apk add bash
# Add your specifc dependencies
RUN cd /usr/local/bin && \
wget https://services.gradle.org/distributions/gradle-5.6-all.zip && \
/usr/bin/unzip gradle-5.6-all.zip && \
ln -s /usr/local/bin/gradle-5.6/bin/gradle /usr/bin/gradle
# Copy your code in the build container and move into it
RUN mkdir -p /app
COPY . /app
WORKDIR /app
# Build your application
RUN gradle build -x test
# The container that will run
FROM openjdk:8-alpine AS run
# Choose the port to publicly expose to the internet
EXPOSE 8080
# Add required packages
RUN apk update && apk upgrade && apk add shadow
# Create a dedicated user to run your app with (for security reasons)
RUN useradd -ms /bin/bash qovery
USER qovery
# Get the build artifact (can be a folder)
COPY --from=build /app/build/libs/simple-example-1.0.jar /app.jar
# Set specific environment variables
ENV JAVA_OPTS=""
# Command to run your application
CMD exec java $JAVA_OPTS -jar /app.jar