This is how my Dockerfile
looks like
FROM elixir:1.10.4-alpine AS build
ARG CIRCLE_BUILD_NUM
ENV CIRCLE_BUILD_NUM=$CIRCLE_BUILD_NUM
ENV MIX_ENV=prod \
LANG=C.UTF-8
RUN mix local.hex --force && \
mix local.rebar --force
# Create the application build directory
RUN mkdir /apps
COPY . /apps
WORKDIR /apps/
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get
RUN mix deps.compile
#releases
RUN MIX_ENV=prod mix release my_app
FROM alpine:3.12 as apps
WORKDIR /apps
RUN apk add --no-cache libressl ncurses-libs
RUN mkdir -p /apps/my_app
# create a new user
RUN addgroup -S elixir_app && adduser -S elixir_app -G elixir_app
RUN chown elixir_app:elixir_app /apps
USER elixir_app
COPY --from=build --chown=elixir_app:elixir_app /apps/_build/prod/rel/my_app /apps/my_app
And this is my docker-compose
file
version: '3.2'
networks:
net:
services:
my_app:
container_name: my_app
image: "my_app/myapp-${CIRCLE_BUILD_NUM}"
environment:
----------------------
expose:
- "${PORT}"
ports:
- "${PORT}:${PORT}"
command: /apps/my_app/bin/my_app start
When I run docker-compose -f docker-compose.yml up -d
I get
Starting my_app_1 … done
But When I run
docker exec -it my_app /apps/my_app/bin/my_app eval "MyApp.Release.migrate"
getting
Error response from daemon: Container e91f88998632481a657d5c66eafaf4f970a4e3203aac129c46d194f31bcdab63 is not running
Can anyone help me with this?