| # Dockerfile | |
| FROM elixir:1.14-alpine | |
| # Install build dependencies | |
| RUN apk add --no-cache build-base npm git python3 | |
| # Install hex and rebar | |
| RUN mix local.hex --force && \ | |
| mix local.rebar --force | |
| # Set working directory | |
| WORKDIR /app | |
| # Create necessary directories | |
| RUN mkdir -p priv/static/assets priv/static/images | |
| # Copy mix files | |
| COPY mix.exs mix.lock ./ | |
| # Copy config files first | |
| COPY config config | |
| # Install mix dependencies | |
| RUN mix deps.get | |
| # Copy the rest of the application | |
| COPY assets assets | |
| COPY priv priv | |
| COPY lib lib | |
| # Compile the project | |
| RUN mix do compile | |
| # Build assets | |
| RUN cd assets && npm install && npm run deploy | |
| RUN mix phx.digest | |
| ENV MIX_ENV=prod | |
| ENV PORT=7860 | |
| # Run the Phoenix app | |
| CMD ["mix", "phx.server"] | |