Skip to content

Commit 3456c91

Browse files
committed
Add Docker volume
1 parent 4c78a9f commit 3456c91

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ FROM openjdk:24-jdk-slim@sha256:df6c3a966c372fa314ec0dc428bf27f8aa28316a173d3d6e
22

33
# Create a custom user with UID 1234 and GID 1234
44
# https://www.docker.com/blog/understanding-the-docker-user-instruction/
5-
RUN groupadd -g 1234 customgroup && \
6-
useradd -m -u 1234 -g customgroup customuser
5+
RUN groupadd -g 1234 app-group && \
6+
useradd -m -u 1234 -g app-group app-user
77

88
# Set the directory for executing future commands
9-
WORKDIR /home/customuser
9+
WORKDIR /home/app-user
1010

1111
# Extract from .tar and copy the app files from host machine to image filesystem
1212
ADD helidon/build/distributions/helidon-*.tar .
13-
RUN mv helidon-* app && chown -R customuser:customgroup app
13+
RUN mv helidon-* app && chown -R app-user:app-group app
1414

1515
# Switch to the custom user
16-
USER customuser
16+
USER app-user
1717

1818
# Run the Main class
1919
# https://docs.docker.com/reference/build-checks/json-args-recommended/
20-
ENTRYPOINT ["/home/customuser/app/bin/helidon"]
20+
ENTRYPOINT ["/home/app-user/app/bin/helidon"]
2121

2222
EXPOSE 8080/tcp

docker-compose.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ services:
66
- "8080:8080"
77
networks:
88
- bridge-net
9+
volumes:
10+
- helidon-se:/home/app-user/
911

1012
networks:
1113
bridge-net:
12-
driver: bridge
14+
driver: bridge
15+
16+
volumes:
17+
helidon-se:

0 commit comments

Comments
 (0)