diff --git a/.github/workflows/docker_release.yml b/.github/workflows/docker_release.yml index 60000ba0..f80cca46 100644 --- a/.github/workflows/docker_release.yml +++ b/.github/workflows/docker_release.yml @@ -75,7 +75,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - file: ./selfhosted.Dockerfile + file: ./docker/selfhosted.Dockerfile # If the event is a release, use the release_arch, otherwise use the # platforms input if present, falling back to dev_arch platforms: ${{ github.event_name == 'release' && env.release_arch || (github.event.inputs.platforms || env.dev_arch) }} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index b6c91591..00000000 --- a/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -assets/vendor/ -deps/ -_build/ diff --git a/README.md b/README.md index d8e45649..ecf68868 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ services: 2. Prepare the docker image in one of the two ways below: - **From GHCR:** `docker pull ghcr.io/kieraneglin/pinchflat:latest` - NOTE: also available on Docker Hub at `keglin/pinchflat:latest` - - **Building locally:** `docker build . --file selfhosted.Dockerfile -t ghcr.io/kieraneglin/pinchflat:latest` + - **Building locally:** `docker build . --file docker/selfhosted.Dockerfile -t ghcr.io/kieraneglin/pinchflat:latest` 3. Run the container: ```bash diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index d4f4d6fb..4ada043e 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -1,9 +1,8 @@ -version: '3' services: phx: build: context: . - dockerfile: dev.Dockerfile + dockerfile: ./docker/dev.Dockerfile environment: - MIX_ENV=test volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 31e897e1..aad86e82 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,13 @@ -version: '3' services: phx: build: context: . - dockerfile: dev.Dockerfile + dockerfile: ./docker/dev.Dockerfile volumes: - '.:/app' ports: - '4008:4008' - command: - - ./docker-run.dev.sh + command: bash -c "chmod +x docker/docker-run.dev.sh && docker/docker-run.dev.sh" stdin_open: true tty: true env_file: diff --git a/dev.Dockerfile b/docker/dev.Dockerfile similarity index 96% rename from dev.Dockerfile rename to docker/dev.Dockerfile index 2429ae8a..e7c54d43 100644 --- a/dev.Dockerfile +++ b/docker/dev.Dockerfile @@ -53,9 +53,6 @@ ENV LC_ALL en_US.UTF-8 WORKDIR /app COPY . ./ -# Needs permissions to be updated AFTER the copy step -RUN chmod +x ./docker-run.dev.sh - # Install Elixir deps # RUN mix archive.install github hexpm/hex branch latest RUN mix deps.get diff --git a/docker-run.dev.sh b/docker/docker-run.dev.sh similarity index 100% rename from docker-run.dev.sh rename to docker/docker-run.dev.sh diff --git a/selfhosted.Dockerfile b/docker/selfhosted.Dockerfile similarity index 100% rename from selfhosted.Dockerfile rename to docker/selfhosted.Dockerfile diff --git a/mix.exs b/mix.exs index 161bd86a..fe018b48 100644 --- a/mix.exs +++ b/mix.exs @@ -87,6 +87,9 @@ defmodule Pinchflat.MixProject do # See the documentation for `Mix` for more info on aliases. defp aliases do [ + format: "format --dot-formatter=tooling/.formatter.exs", + check: "check --config=tooling/.check.exs", + credo: "credo --config-file=tooling/.credo.exs", setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"], "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], "ecto.reset": ["ecto.drop", "ecto.setup"], diff --git a/package.json b/package.json index a9a1b234..fab6aa52 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "sqleton": "^2.2.0" }, "scripts": { - "create-erd": "sqleton -o priv/repo/erd.png priv/repo/pinchflat_dev.db" + "create-erd": "sqleton -o priv/repo/erd.png priv/repo/pinchflat_dev.db", + "lint:check": "prettier . --check --config=tooling/.prettierrc.js --ignore-path=tooling/.prettierignore --ignore-path=.gitignore", + "lint:fix": "prettier . --write --config=tooling/.prettierrc.js --ignore-path=tooling/.prettierignore --ignore-path=.gitignore" }, "private": true } diff --git a/.check.exs b/tooling/.check.exs similarity index 92% rename from .check.exs rename to tooling/.check.exs index da0bf225..98ca0e20 100644 --- a/.check.exs +++ b/tooling/.check.exs @@ -16,7 +16,7 @@ {:compiler, env: %{"MIX_ENV" => "test"}}, {:formatter, env: %{"MIX_ENV" => "test"}}, {:sobelow, "mix sobelow --config"}, - {:prettier_formatting, "yarn run prettier . --check", fix: "yarn run prettier . --write"}, + {:prettier_formatting, "yarn run lint:check", fix: "yarn run lint:fix"}, {:npm_test, false} ## curated tools may be disabled (e.g. the check for compilation warnings) diff --git a/.credo.exs b/tooling/.credo.exs similarity index 100% rename from .credo.exs rename to tooling/.credo.exs diff --git a/.formatter.exs b/tooling/.formatter.exs similarity index 100% rename from .formatter.exs rename to tooling/.formatter.exs diff --git a/tooling/.prettierignore b/tooling/.prettierignore new file mode 100644 index 00000000..937ae7ca --- /dev/null +++ b/tooling/.prettierignore @@ -0,0 +1 @@ +../assets/vendor/ diff --git a/.prettierrc.js b/tooling/.prettierrc.js similarity index 100% rename from .prettierrc.js rename to tooling/.prettierrc.js