Skip to content

Commit

Permalink
Merge branch 'main' into skander/fix-lat-lng
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Jul 27, 2023
2 parents ea7373b + 8367956 commit 44deb25
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 27 deletions.
29 changes: 26 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
server/_build
server/deps
**/node_modules
### server

# build
server/_build/
server/priv/static/assets/
server/priv/static/cache_manifest.json

# deps
server/deps/
server/**/node_modules/

# other
server/.elixir_ls

### ui

# build
ui/build/
ui/.next/
ui/out/

# deps
ui/node_modules/

### misc
.DS_Store
19 changes: 16 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,27 @@ EXPOSE 3000
EXPOSE 4000
ENV PORT=4000 UI_PORT=3000 MIX_ENV=dev

# Install and cache server deps
### Install dependencies and compile

# Download and compile server deps
ADD server/mix.exs server/mix.lock server/
ADD server/config server/config/
RUN cd server && mix do deps.get, deps.compile

# Same with ui deps
# Download and install UI deps
ADD ui/package.json ui/package-lock.json ui/
RUN cd ui && npm install

# Compile server code
ADD server server/
RUN cd server && mix compile
RUN cd server && mix do tailwind.install, esbuild.install

# Compile UI code
ADD ui ui/
RUN cd ui && npm run build:dev

# Copy remaining files
ADD . .

CMD ["/bin/bash", "-c", "cd server && mix ecto.setup && mix phx.server & cd ui && npm run dev"]
CMD ["/bin/bash", "-c", "cd server && mix ecto.setup && mix phx.server & cd ui && npm run start:dev"]
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.8"

services:
web:
Expand All @@ -10,7 +10,8 @@ services:
- "3000:3000"
- "4000:4000"
depends_on:
- db
db:
condition: service_healthy
links:
- db

Expand All @@ -21,3 +22,10 @@ services:
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASS=postgres
restart: on-failure
healthcheck:
test: "PGUSER=$$POSTGRES_USER PGPASSWORD=$$POSTGRES_PASS PGHOST=localhost pg_isready"
# TODO: enable start_interval once docker 25.0.0 is released
# https://github.com/moby/moby/issues/45897
# start_period: 60s
# start_interval: 5s
63 changes: 44 additions & 19 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"scripts": {
"dev": "next dev -p ${UI_PORT:-3000}",
"build": "next build",
"build:dev": "dotenv -c development npm run build",
"start": "next start -p ${UI_PORT:-3000}",
"start:dev": "dotenv -c development npm run start",
"lint": "next lint",
"lint:fix": "next lint --fix",
"format": "prettier . --write",
Expand All @@ -23,6 +25,7 @@
"@mui/material": "^5.13.5",
"@tanstack/react-query": "^4.29.15",
"clsx": "^1.2.1",
"dotenv-cli": "^7.2.1",
"graphql": "^16.7.0",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.1",
Expand Down

0 comments on commit 44deb25

Please sign in to comment.