Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FROM elixir:latest
- # Create and set home directory
- ENV HOME /opt/Sampler
- WORKDIR $HOME
- # Configure required environment
- ENV MIX_ENV prod
- # Set and expose PORT environmental variable
- ENV PORT=4000
- EXPOSE 4000
- # Install hex (Elixir package manager)
- RUN mix local.hex --force
- # Install rebar (Erlang build tool)
- RUN mix local.rebar --force
- # Copy all dependencies files
- COPY mix.* ./
- # Install all production dependencies
- RUN mix deps.get --only prod
- # Compile all dependencies
- RUN mix deps.compile
- # Copy all application files
- COPY . $HOME
- ENTRYPOINT ["mix"]
- # Compile the entire project
- RUN ["mix", "compile"]
- CMD ["phx.server"]
- ## Compose
- version: '3'
- services:
- db:
- image: postgres
- restart: always
- environment:
- POSTGRES_PASSWORD: ""
- POSTGRES_USER: "postgres"
- POSTGRES_DB: "sampler_prod"
- ports:
- - "5432:5432"
- web:
- build: .
- image: first_playground_elixir:latest
- environment:
- db: db
- db_username: "postgres"
- db_password: ""
- db_name: "sampler_prod"
- ports:
- - "80:4000"
- depends_on:
- - db
- links:
- - db
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement