Fix entrypoint.sh permissions in Docker container
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
- Reorder Dockerfile to create phoenix user before copying entrypoint.sh - Use --chown flag to set proper ownership of entrypoint.sh - Resolves "Permission denied" error when starting container 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9b55c6e446
commit
90cfeec59b
1 changed files with 8 additions and 12 deletions
20
Dockerfile
20
Dockerfile
|
|
@ -36,33 +36,29 @@ RUN mix assets.deploy
|
||||||
# Build release
|
# Build release
|
||||||
RUN mix release
|
RUN mix release
|
||||||
|
|
||||||
# App stage
|
# App stage - use same elixir base to ensure OpenSSL compatibility
|
||||||
FROM alpine:3.19 AS app
|
FROM elixir:1.17-alpine AS app
|
||||||
|
|
||||||
# Install runtime dependencies including OpenSSL 3.x
|
# Install runtime dependencies
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
libstdc++ \
|
libstdc++ \
|
||||||
openssl \
|
openssl \
|
||||||
openssl-dev \
|
ncurses-libs
|
||||||
ncurses-libs \
|
|
||||||
libgcc \
|
|
||||||
libcrypto3 \
|
|
||||||
libssl3
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the release from build stage
|
# Copy the release from build stage
|
||||||
COPY --from=build /app/_build/prod/rel/my_first_elixir_vibe_code ./
|
COPY --from=build /app/_build/prod/rel/my_first_elixir_vibe_code ./
|
||||||
|
|
||||||
# Copy entrypoint script
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
|
||||||
RUN chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
# Create a non-root user
|
# Create a non-root user
|
||||||
RUN addgroup -g 1000 phoenix && \
|
RUN addgroup -g 1000 phoenix && \
|
||||||
adduser -D -u 1000 -G phoenix phoenix && \
|
adduser -D -u 1000 -G phoenix phoenix && \
|
||||||
chown -R phoenix:phoenix /app
|
chown -R phoenix:phoenix /app
|
||||||
|
|
||||||
|
# Copy entrypoint script and set permissions
|
||||||
|
COPY --chown=phoenix:phoenix entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
USER phoenix
|
USER phoenix
|
||||||
|
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue