-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
executable file
·29 lines (22 loc) · 869 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Use Elixir 1.12 as the base image
FROM elixir:1.12
# Install MariaDB server and client
RUN apt-get update && \
apt-get install -y mariadb-server default-mysql-client git
# Set environment variables
ENV MIX_ENV=dev
# Create app directory
WORKDIR /app
# Copy the application code to the container
COPY . /app
# Install dependencies
RUN mix local.hex --force && \
mix deps.get
# Set up the database
RUN service mariadb start && \
sleep 1 && \
mysql -u root -e "CREATE DATABASE IF NOT EXISTS betunfair; CREATE DATABASE IF NOT EXISTS betunfair_test; CREATE USER 'betunfair'@'localhost' IDENTIFIED BY '9sX5^6a2jJng'; GRANT ALL PRIVILEGES ON betunfair.* TO 'betunfair'@'localhost'; GRANT ALL PRIVILEGES ON betunfair_test.* TO 'betunfair'@'localhost'; FLUSH PRIVILEGES;" && \
mix ecto.create && \
mix ecto.migrate
# Expose the port
EXPOSE 4000