initial docker setup for bump

This commit is contained in:
2022-01-11 13:49:43 +01:00
commit 761700386c
4 changed files with 75 additions and 0 deletions

16
bump/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# Elixir + Phoenix
FROM elixir:1.12.2
# Install debian packages
RUN apt-get update
RUN apt-get install --yes build-essential inotify-tools postgresql-client
# Install Phoenix packages
RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix archive.install hex phx_new --force
COPY setup.sh /usr/local/bin/
EXPOSE 4012
ENTRYPOINT ["setup.sh"]

31
bump/setup.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
# Adapted from Alex Kleissner's post, Running a Phoenix 1.3 project with docker-compose
# https://medium.com/@hex337/running-a-phoenix-1-3-project-with-docker-compose-d82ab55e43cf
cd /app/
set -e
# Ensure the app's dependencies are installed
mix deps.get --only prod
#Analysis style code
# Prepare Credo if the project has Credo start code analyze
if mix help credo >/dev/null 2>&1
then
echo "\nFound Credo: analyzing..."
mix credo || true
else
echo "\nNo Credo config: Skipping code analyze..."
fi
# Potentially Set up the database
MIX_ENV=prod mix ecto.create
MIX_ENV=prod mix ecto.migrate
echo "\nTesting the installation..."
# "Prove" that install was successful by running the tests
mix test
echo "\n Launching Phoenix web server..."
# Start the phoenix web server
PORT=4012 MIX_ENV=prod mix phx.server