memex-in commited on
Commit
f46a386
·
verified ·
1 Parent(s): 6d3bb8b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -32
Dockerfile CHANGED
@@ -8,6 +8,10 @@ WORKDIR /app
8
  COPY index.html ./
9
  COPY exdocker ./
10
 
 
 
 
 
11
  # Switch to root user to install curl, as apk requires root privileges
12
  USER root
13
  RUN apk add --no-cache curl
@@ -20,35 +24,6 @@ USER docker
20
  # within the DinD container. Then, we can map this 8080 to the host.
21
  EXPOSE 8080
22
 
23
- # The base image's ENTRYPOINT is `dockerd-rootless.sh`.
24
- # We override the default CMD to run our script.
25
- # Our script will:
26
- # 1. Start the rootless daemon in the background.
27
- # 2. Wait for the daemon to be ready.
28
- # 3. Perform the build and run of the inner Nginx container.
29
- # 4. Keep the outer container alive.
30
- CMD ["sh", "-c", "\
31
- # Start the rootless Docker daemon in the background
32
- /usr/local/bin/dockerd-rootless.sh & \
33
- # Wait for the Docker daemon to be fully ready
34
- # This loop is more robust than a fixed sleep
35
- until docker info >/dev/null 2>&1; do \
36
- echo 'Waiting for Docker daemon to start...'; \
37
- sleep 1; \
38
- done; \
39
- echo 'Docker daemon is up and running!'; \
40
- \
41
- # Build the Nginx image using the copied exdocker Dockerfile
42
- docker build -f exdocker -t my-nginx-app . && \
43
- \
44
- # Run the Nginx container in detached mode, mapping its port 80
45
- # to port 8080 *inside this DinD container*.
46
- docker run -d -p 8080:80 --name my-inner-nginx my-nginx-app && \
47
- \
48
- echo 'Inner Nginx container started. Testing accessibility...' && \
49
- \
50
- # Test accessibility of the inner Nginx server
51
- curl http://localhost:8080 && \
52
- \
53
- # Keep this DinD container running indefinitely
54
- sleep infinity"]
 
8
  COPY index.html ./
9
  COPY exdocker ./
10
 
11
+ # Copy the start.sh script and make it executable
12
+ COPY start.sh ./
13
+ RUN chmod +x ./start.sh
14
+
15
  # Switch to root user to install curl, as apk requires root privileges
16
  USER root
17
  RUN apk add --no-cache curl
 
24
  # within the DinD container. Then, we can map this 8080 to the host.
25
  EXPOSE 8080
26
 
27
+ # The base image's ENTRYPOINT is already `dockerd-rootless.sh`.
28
+ # We override the default CMD to run our custom start.sh script.
29
+ CMD ["./start.sh"]