Skip to content

Commit e8463aa

Browse files
committed
Improve symlinking
- Place binaries and symlink in `/usr/local` instead of `/usr`. - LDC: Add symlinks for `ldc2` `ldmd2` to system path. - LDC: Provide `dmd` through a symlink to `ldmd2`.
1 parent 028ad06 commit e8463aa

6 files changed

Lines changed: 31 additions & 23 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
## Install D Tools
2-
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/ddemangle /usr/bin/ddemangle
3-
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/dustmite /usr/bin/dustmite
4-
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/rdmd /usr/bin/rdmd
2+
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/ddemangle /usr/local/bin/ddemangle
3+
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/dustmite /usr/local/bin/dustmite
4+
COPY --from={{ $buildStage }} /opt/build/d-tools/generated/linux/64/rdmd /usr/local/bin/rdmd

templates/dmd/build-dmd.containerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ RUN tar -xf phobos.tar.gz -C phobos --strip-components=1
1919
RUN make -C dmd
2020
{{# endif }}
2121

22-
RUN rm /usr/bin/dmd
23-
RUN ln -s /opt/build/dmd/generated/linux/release/64/dmd /usr/bin/dmd
24-
ENV DMD=/usr/bin/dmd
22+
RUN rm /usr/local/bin/dmd
23+
RUN ln -s /opt/build/dmd/generated/linux/release/64/dmd /usr/local/bin/dmd
24+
ENV DMD=/usr/local/bin/dmd
2525

2626
### Build Phobos
2727
{{# if ($legacyMakefile): }}

templates/dmd/dmd-image.containerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN sed -i 's/\/opt\/ldc/\/opt\/ldc-bootstrap/g' /opt/ldc-bootstrap/etc/ldc2.con
2424
# Download, build and install DMD
2525

2626
{{< dmd/download-dmd-source.containerfile }}
27-
RUN ln -s /opt/ldc-bootstrap/bin/ldmd2 /usr/bin/dmd
27+
RUN ln -s /opt/ldc-bootstrap/bin/ldmd2 /usr/local/bin/dmd
2828

2929
{{< dmd/build-dmd.containerfile }}
3030

@@ -41,8 +41,8 @@ FROM {{ $base_image }} AS export-stage
4141

4242
{{< common/prepare-runtime-environment.containerfile }}
4343

44-
COPY --from=build-stage /opt/build/dmd/generated/linux/release/64/dmd /usr/bin/dmd
45-
COPY --from=build-stage /opt/build/phobos/generated/linux/release/64/* /usr/lib/
44+
COPY --from=build-stage /opt/build/dmd/generated/linux/release/64/dmd /usr/local/bin/dmd
45+
COPY --from=build-stage /opt/build/phobos/generated/linux/release/64/* /usr/local/lib/
4646
{{# if ($druntimeMonorepo): }}
4747
COPY --from=build-stage /opt/build/dmd/druntime/src /usr/include/dmd/druntime/import
4848
{{# else: }}
@@ -51,10 +51,10 @@ COPY --from=build-stage /opt/build/phobos/generated/linux/release/64/* /usr/lib/
5151
COPY --from=build-stage /opt/build/phobos/std /usr/include/dmd/phobos/std
5252
COPY --from=build-stage /opt/build/phobos/etc /usr/include/dmd/phobos/etc
5353
{{# if (isset($extras['dub'])): }}
54-
COPY --from=build-stage /opt/build/dub/bin/dub /usr/bin/dub
54+
COPY --from=build-stage /opt/build/dub/bin/dub /usr/local/bin/dub
5555
{{# endif }}
5656
COPY ./resources/dmd.conf /etc/dmd.conf
57-
COPY ./templates/scripts/entrypoint-dmd.sh /usr/bin/entrypoint
57+
COPY ./templates/scripts/entrypoint-dmd.sh /usr/local/bin/entrypoint
5858

5959
{{< d-tools/install-d-tools.containerfile }}
6060

@@ -63,5 +63,5 @@ COPY ./resources/helloworld.d /opt/helloworld.d
6363
RUN dmd -run /opt/helloworld.d
6464
RUN rm /opt/helloworld.d
6565

66-
ENTRYPOINT [ "/usr/bin/entrypoint" ]
67-
CMD [ "/usr/bin/dmd" ]
66+
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
67+
CMD [ "/usr/local/bin/dmd" ]

templates/ldc-xtensa/ldc-xtensa-image.containerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ FROM {{ $base_image }} AS export-stage
3838

3939
COPY --from={{ $buildStage }} /opt/ldc /opt/ldc
4040

41+
RUN ln -s /opt/ldc/bin/ldc2 /usr/local/bin/ldc2
42+
RUN ln -s /opt/ldc/bin/ldmd2 /usr/local/bin/ldmd2
43+
RUN ln -s /opt/ldc/bin/ldmd2 /usr/local/bin/dmd
44+
ENV DMD=/usr/local/bin/ldmd2
45+
4146
{{< d-tools/install-d-tools.containerfile }}
4247

4348
# Self-test
@@ -46,12 +51,12 @@ RUN /opt/ldc/bin/ldmd2 -run /opt/helloworld.d
4651
RUN rm /opt/helloworld.d
4752

4853
{{# if (isset($extras['dub'])): }}
49-
COPY --from={{ $buildStage }} /opt/build/dub/bin/dub /usr/bin/dub
54+
COPY --from={{ $buildStage }} /opt/build/dub/bin/dub /usr/local/bin/dub
5055
{{# endif }}
5156

5257
{{< d-tools/install-d-tools.containerfile }}
5358

54-
COPY ./templates/scripts/entrypoint-ldc.sh /usr/bin/entrypoint
59+
COPY ./templates/scripts/entrypoint-ldc.sh /usr/local/bin/entrypoint
5560

56-
ENTRYPOINT [ "/usr/bin/entrypoint" ]
57-
CMD [ "/opt/ldc/bin/ldc2" ]
61+
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
62+
CMD [ "/usr/local/bin/ldc2" ]

templates/ldc/ldc-image.containerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ FROM {{ $base_image }} AS export-stage
3838

3939
COPY --from={{ $buildStage }} /opt/ldc /opt/ldc
4040

41+
RUN ln -s /opt/ldc/bin/ldc2 /usr/local/bin/ldc2
42+
RUN ln -s /opt/ldc/bin/ldmd2 /usr/local/bin/ldmd2
43+
RUN ln -s /opt/ldc/bin/ldmd2 /usr/local/bin/dmd
44+
ENV DMD=/usr/local/bin/ldmd2
45+
4146
{{< d-tools/install-d-tools.containerfile }}
4247

4348
# Self-test
@@ -46,12 +51,12 @@ RUN /opt/ldc/bin/ldmd2 -run /opt/helloworld.d
4651
RUN rm /opt/helloworld.d
4752

4853
{{# if (isset($extras['dub'])): }}
49-
COPY --from={{ $buildStage }} /opt/build/dub/bin/dub /usr/bin/dub
54+
COPY --from={{ $buildStage }} /opt/build/dub/bin/dub /usr/local/bin/dub
5055
{{# endif }}
5156

5257
{{< d-tools/install-d-tools.containerfile }}
5358

54-
COPY ./templates/scripts/entrypoint-ldc.sh /usr/bin/entrypoint
59+
COPY ./templates/scripts/entrypoint-ldc.sh /usr/local/bin/entrypoint
5560

56-
ENTRYPOINT [ "/usr/bin/entrypoint" ]
57-
CMD [ "/opt/ldc/bin/ldc2" ]
61+
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
62+
CMD [ "/usr/local/bin/ldc2" ]

templates/scripts/entrypoint-ldc.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/sh
22
set -e
33

4-
export PATH="/opt/ldc/bin:$PATH"
5-
64
if [ "$(ulimit -n)" -gt 5120 ]; then
75
ulimit -n 5120 || true
86
fi

0 commit comments

Comments
 (0)