Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stages to dockerfile to speed up local dev builds #156

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,4 @@ ui/.next/
ui/out/

# deps
ui/node_modules/

### misc
.DS_Store
ui/node_modules/
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
46 changes: 19 additions & 27 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
# App artifacts
/_build
/db
/deps
/*.ez
# The directory Mix will write compiled artifacts to.
/_build/

/rel
# If you run "mix test --cover", coverage assets end up here.
/cover/

node_modules/
# The directory Mix downloads your dependencies sources to.
/deps/

.vscode/
# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/

# Generated on crash by the VM
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets files as long as you replace their contents by environment
# variables.
/config/*.secret.exs
# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Temporary files, for example, from tests.
/tmp/

assets/src/config/
# Ignore package tarball (built via "mix hex.build").
hello-*.tar

# Ignore assets that are produced by build tools.
/priv/static/assets/

# Ignore digested assets cache.
/priv/static/cache_manifest.json

# Webstorm
.idea/

bash /

docker/

*.log

.elixir_ls/
# In case you use Node.js/npm, you want to ignore these.
npm-debug.log
/assets/node_modules/
Loading