Skip to content

Commit

Permalink
Add stages to dockerfile to speed up local dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcretu committed Jul 27, 2023
1 parent 8367956 commit 53ad9e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG ELIXIR_VERSION=1.14
ARG NODE_VERSION=20.2.0

FROM node:${NODE_VERSION}-alpine AS node
FROM elixir:${ELIXIR_VERSION}-alpine
FROM elixir:${ELIXIR_VERSION}-alpine AS setup


### Install deps
Expand Down Expand Up @@ -47,6 +47,10 @@ EXPOSE 3000
EXPOSE 4000
ENV PORT=4000 UI_PORT=3000 MIX_ENV=dev

# Create a new stage so that local dev setup can stop here
# Local dev mounts into the container so there's no point in adding/compiling
FROM setup AS compile

### Install dependencies and compile

# Download and compile server deps
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
version: "3"
services:
web:
build:
context: ./
target: setup
command: sleep infinity
depends_on:
- db
volumes:
- .:/app

0 comments on commit 53ad9e7

Please sign in to comment.