ratemyclient/Dockerfile
Kevin Sivic 9b55c6e446
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Fix Docker OpenSSL compatibility and deprecation warnings
- Add OpenSSL 3.x libraries to runtime stage (libcrypto3, libssl3, openssl-dev)
- Fix deprecation warning by adding parentheses to function calls in release.ex
- Resolves crypto library loading errors in Docker container

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 22:15:45 -05:00

71 lines
1.3 KiB
Docker

# Build stage
FROM elixir:1.17-alpine AS build
# Install build dependencies
RUN apk add --no-cache build-base git
# Prepare build dir
WORKDIR /app
# Install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# Set build ENV
ENV MIX_ENV=prod
# Install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only prod
RUN mix deps.compile
# Copy application files
COPY config config
COPY priv priv
COPY lib lib
# Compile the project (generates phoenix-colocated files)
RUN mix compile
# Copy assets after compilation
COPY assets assets
# Compile and deploy assets
RUN mix assets.deploy
# Build release
RUN mix release
# App stage
FROM alpine:3.19 AS app
# Install runtime dependencies including OpenSSL 3.x
RUN apk add --no-cache \
libstdc++ \
openssl \
openssl-dev \
ncurses-libs \
libgcc \
libcrypto3 \
libssl3
WORKDIR /app
# Copy the release from build stage
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
RUN addgroup -g 1000 phoenix && \
adduser -D -u 1000 -G phoenix phoenix && \
chown -R phoenix:phoenix /app
USER phoenix
EXPOSE 4000
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bin/my_first_elixir_vibe_code", "start"]