From 50ce8cb96b2b218751c2fc2a6b19372f51846acc Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Mon, 14 Jul 2025 19:34:59 +0300 Subject: feat: rewrite in rust --- Dockerfile | 84 -------------------------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 Dockerfile (limited to 'Dockerfile') 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 -- cgit v1.2.3