diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-14 19:34:59 +0300 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2025-07-14 19:34:59 +0300 |
| commit | 50ce8cb96b2b218751c2fc2a6b19372f51846acc (patch) | |
| tree | e2c634d2ce856062d527667d47815a05a53361c8 /Dockerfile | |
| parent | 0ab2e5ba2b0631b28b5b1405559237b3913c878f (diff) | |
feat: rewrite in rust
Diffstat (limited to 'Dockerfile')
| -rw-r--r-- | Dockerfile | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d54e6e9..0000000 --- a/Dockerfile +++ /dev/null @@ -1,84 +0,0 @@ -# Stage 1: Build the application -FROM hexpm/elixir:1.18.3-erlang-25.0.4-debian-bookworm-20250317-slim AS build - -# Install build dependencies -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends build-essential git && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set environment variables -ENV MIX_ENV=prod - -# Prepare build directory -WORKDIR /app - -# Install hex and rebar -RUN mix local.hex --force && \ - mix local.rebar --force - -# Copy configuration files first to cache dependencies -COPY mix.exs mix.lock ./ -COPY config config - -# Get dependencies -RUN mix deps.get --only prod - -# Copy the rest of the application code -COPY lib lib -COPY priv priv -# No rel directory yet -# COPY rel rel - -# Compile the application and create release -RUN mix deps.compile -RUN mix compile -RUN mix release - -# Stage 2: Create the minimal runtime image -FROM debian:bookworm-slim AS app - -# Install runtime dependencies -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends \ - libstdc++6 \ - openssl \ - ca-certificates \ - ncurses-bin \ - sqlite3 \ - libsqlite3-dev \ - curl && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -# Set environment variables -ENV LANG=C.UTF-8 \ - PHX_SERVER=true \ - DB_ADAPTER=sqlite \ - DATABASE_URL=sqlite3:/app/data/silmataivas.db - -WORKDIR /app - -# Copy the release from the build stage -COPY --from=build /app/_build/prod/rel/silmataivas ./ - -# Create data directory and non-root user with proper permissions -RUN mkdir -p /app/data && \ - useradd -m silmataivas && \ - chown -R silmataivas:silmataivas /app && \ - chmod -R 750 /app/data - -USER silmataivas - -# Document which ports the application uses -EXPOSE 4000 - -# Define volumes for persistence -VOLUME ["/app/data"] - -# Add health check -HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ - CMD curl -f http://localhost:4000/health || exit 1 - -# Set the command to start the app -CMD ["/app/bin/silmataivas", "start"]
\ No newline at end of file |
