Skip to content

Commit 1c1a363

Browse files
committed
fix: correct directory structure for prima path dependency
The demo depends on prima with path: "..", so the demo must be at /prima/demo for the path dependency to resolve correctly. Previously the demo was at /app/demo which made ".." resolve to /app instead of /prima where the library code is located. Changes: - Start with WORKDIR /prima instead of /app - Copy prima library files directly to /prima - Put demo at /prima/demo so path ".." resolves to /prima - Update final stage to copy from /prima/demo instead of /app/demo
1 parent 8060a41 commit 1c1a363

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

demo/Dockerfile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
2929
&& apt-get install -y nodejs
3030

3131
# prepare build dir
32-
WORKDIR /app
32+
WORKDIR /prima
3333

3434
# install hex + rebar
3535
RUN mix local.hex --force && \
@@ -38,22 +38,21 @@ RUN mix local.hex --force && \
3838
# set build ENV
3939
ENV MIX_ENV="prod"
4040

41-
# Copy prima library (path dependency) to parent of build directory
42-
COPY mix.exs mix.lock /prima/
43-
COPY lib /prima/lib
44-
COPY assets /prima/assets
45-
COPY config /prima/config
41+
# Copy prima library (root directory)
42+
COPY mix.exs mix.lock ./
43+
COPY lib lib
44+
COPY assets assets
45+
COPY config config
4646

4747
# Build prima library assets
48-
WORKDIR /prima
4948
RUN mix deps.get --only prod
5049
RUN npm install --prefix ./assets
5150
RUN mix assets.setup
5251
RUN mix assets.build
5352
RUN mix compile
5453

55-
# Copy demo application files to /app/demo (so path ".." resolves to /prima)
56-
WORKDIR /app/demo
54+
# Copy demo application files to /prima/demo (so path ".." resolves to /prima)
55+
WORKDIR /prima/demo
5756
COPY demo/mix.exs demo/mix.lock ./
5857
RUN mix deps.get --only $MIX_ENV
5958
RUN mkdir config
@@ -106,7 +105,7 @@ RUN chown nobody /app
106105
ENV MIX_ENV="prod"
107106

108107
# Only copy the final release from the build stage
109-
COPY --from=builder --chown=nobody:root /app/demo/_build/${MIX_ENV}/rel/demo ./
108+
COPY --from=builder --chown=nobody:root /prima/demo/_build/${MIX_ENV}/rel/demo ./
110109

111110
USER nobody
112111

0 commit comments

Comments
 (0)