action-requests-demo.jamey..../Dockerfile
James Greenwood cc4cc65950
All checks were successful
build / build (push) Successful in 11s
Initial commit: Phoenix LiveView demo for interactive data tables with filtering, sorting, pagination, URL state, and progressive enhancement
Implements a fully-featured action requests table in a single LiveView module using Flop, Ecto, and SQLite. Includes:

- Fuzzy search, status/assignment filters, column sorting, 15-per-page pagination
- Real-time updates, bookmarkable URLs via `handle_params/3`
- JS-disabled fallback with GET forms (no duplicate logic)
- 1,000,000 seeded records, Tailwind + DaisyUI styling, light/dark themes
- Comprehensive README with comparisons to Django+React/Rails+React stacks
- 31 tests covering all scenarios

Tech: Phoenix 1.8+, LiveView, Flop, Ecto, SQLite, Elixir 1.15+
2025-11-17 14:42:00 +00:00

73 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1.7
# Use the official Alpine Elixir image; keep the version in sync with mix.exs
ARG ELIXIR_VERSION=1.15
FROM elixir:${ELIXIR_VERSION}-alpine AS build
ENV LANG="en_US.UTF-8" \
MIX_ENV="prod" \
HOME="/app"
WORKDIR /app
RUN apk update && \
apk add --no-cache \
build-base \
sqlite-dev \
openssl-dev \
ca-certificates
RUN mix do local.hex --force, local.rebar --force
# Only copy files necessary to download deps to maximize layer caching
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get --only ${MIX_ENV} && \
mix deps.compile
# Copy the rest of the application source
COPY lib lib
COPY priv priv
COPY assets assets
RUN mix compile
RUN mix assets.deploy
RUN mix release
# Minimal runtime image
FROM alpine:3.19 AS app
ENV LANG="en_US.UTF-8" \
MIX_ENV="prod" \
PORT="4000" \
PHX_SERVER="true" \
DATABASE_PATH="/app/data/action_requests_demo.db"
WORKDIR /app
RUN apk add --no-cache \
openssl \
ncurses-libs \
libstdc++ \
sqlite \
ca-certificates
# Keep SQLite data outside of the release directory so it can persist as a volume
RUN install -d -m 0755 /app/data
COPY --from=build /app/_build/prod/rel/action_requests_demo ./
RUN addgroup -S app && \
adduser -S app -G app && \
chown -R app:app /app
USER app
EXPOSE 4000
VOLUME ["/app/data"]
ENTRYPOINT ["./bin/action_requests_demo"]
CMD ["start"]