soyjeansoy

soyjeansoy

hi everyone, how can i mix deps.get when im using docker?
whenever i run docker-compose run web mix phx.new hello and press yes, it didnt get past mix deps.get

now if i go to hello dir and do docker-compose run web mix deps.get , it says cant find mix project (mix.exs)

sorry if its a desperate question, im new to docker and I tried numerous sample docker setup via github.

# Dockerfile
version: '3.2'
services:
  db:
    image: postgres:alpine

  web:
    build: .
    volumes:
      - type: bind
        source: .
        target: /app
    ports:
      - "4000:4000"
    depends_on:
      - db
# docker-compose.yml
FROM elixir:alpine

RUN apk add postgresql-client inotify-tools nodejs

RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix archive.install hex phx_new --force

WORKDIR /app
EXPOSE 4000

Showing Posts 1 to 7

kynoshi

kynoshi

Hi soyjeansoy!

My first lucky guess is that the container you are running deps.get isn’t configured to sustain the data mix is creating/downloading. If you can put a minimal setup of your codebase/environment anywhere on github, I would be happy to have a look on it for you.

soyjeansoy

soyjeansoy OP

hi @kynoshi thank you for helping me out.

im using this setup. im doing as simple as I can just so I could understand every step.

kynoshi

kynoshi

The docker compose file you uploaded on github is a bit different than the one you put on in this thread. But that’s irrelevant to your issue anyways.

You do not have an elixir issue, rather than a simple folders confusion and/or docker learning opportunity. Setting up the phoenix project using docker-compose run web mix phx.new hello runs well and uses /app as your current workfolder.

When you try to update the elixir dependencies using docker-compose run web mix deps.get you are STILL working inside the /app folder, but you want to run the command inside /app/hello where the mix.exs is located. For a better illustration of what this means, see the screenshot below.

I recommend giving docker-compose run web /bin/sh a try, to fiddle around a bit inside the container and to get a better mental model of elixir projects inside a docker container.

Have fun! :slight_smile:

soyjeansoy

soyjeansoy OP

oh got it thank you! yea im confused where should i run the commands :smile:

emoragaf

emoragaf

So coincidentally I blogged a couple of days ago about using docker and docker compose with elixir.

The idea was to setup a dev environment with docker as the only dependency needed.

I started with a project folder and all the docker stuff (docker-compose + dockerfile)

Then I did two things to try to make things simpler:

  1. I created 2 bash scripts mix and iex that wrap docker-compose run app mix/iex calls
  2. I created my elixir/phx project directly on the current project directory, e.g: mix phx.new . --app my_app

The post is in spanish, so i won’t shamelessly plug it here, but I added all the code on this repo (there are numbered branches that show the steps involved)

soyjeansoy

soyjeansoy OP

@emoragaf thank you for helping. You added node in Dockerfile, how can we achieve the same thing with docker-compose.yml?

emoragaf

emoragaf

I guess that you could try to find a base image (or create one and publish it) that already has all the os dependencies that you need. And only define a docker-compose.yml

But in general I would create a Dockerfile for each project

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews