Skip to content

Commit

Permalink
chore: refactor Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kucaahbe committed Feb 18, 2024
1 parent 9cffc22 commit 2bd757b
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
# syntax=docker/dockerfile:1
FROM dlang2/dmd-ubuntu

WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/root/.dub dub build
RUN ln -s /app/myrc /usr/local/bin/myrc
COPY . /app
RUN --mount=type=cache,target=/root/.dub <<BUILD
cd /app
dub build
ln -s /app/myrc /usr/local/bin/myrc
BUILD

ARG example_dir_1=/home/dlang/dotfiles/example1
ARG example_dir_2=/home/dlang/dotfiles/example2
COPY test $example_dir_1
RUN <<EOF
mkdir -p $example_dir_2
echo "echo wrong location 1" > $example_dir_2/wrong_location1
EOF

USER dlang

WORKDIR $example_dir_1
COPY test .

WORKDIR $example_dir_2
RUN echo "echo wrong location 1" > wrong_location1

WORKDIR /home/dlang
RUN ln -s $example_dir_1/zshrc ~/.zshrc
RUN ln -s ./dotfiles/example1/ls_colors ~/.ls_colors
RUN ln -s $example_dir_2/wrong_location1 ~/.zshenv

WORKDIR $example_dir_1
RUN <<LN
set -e
ln -s $example_dir_1/zshrc ~/.zshrc
ln -s ./dotfiles/example1/ls_colors ~/.ls_colors
ln -s $example_dir_2/wrong_location1 ~/.zshenv
LN

WORKDIR $example_dir_1
CMD mkdir ~/.zsh && myrc && myrc install && myrc && ls -la ~

0 comments on commit 2bd757b

Please sign in to comment.