mirror of
https://github.com/ClaperCo/Claper.git
synced 2025-12-16 11:57:58 +01:00
Add docker file for dev
This commit is contained in:
83
Dockerfile.dev
Normal file
83
Dockerfile.dev
Normal file
@@ -0,0 +1,83 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
# Set bash as the default shell
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
# Avoid prompts during package installation
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Set up timezone
|
||||
RUN apt-get update && apt-get install -y tzdata \
|
||||
&& ln -fs /usr/share/zoneinfo/UTC /etc/localtime \
|
||||
&& dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
git \
|
||||
curl \
|
||||
wget \
|
||||
gnupg \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
lsb-release \
|
||||
python3 \
|
||||
openssl \
|
||||
libncurses5-dev \
|
||||
locales \
|
||||
inotify-tools \
|
||||
unzip \
|
||||
automake \
|
||||
autoconf \
|
||||
libreadline-dev \
|
||||
libssl-dev \
|
||||
libyaml-dev \
|
||||
libxslt-dev \
|
||||
libffi-dev \
|
||||
libtool \
|
||||
openjdk-11-jdk \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set locale
|
||||
RUN locale-gen en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
|
||||
# Install asdf
|
||||
ENV ASDF_VERSION=0.18.0
|
||||
RUN wget https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz \
|
||||
&& tar -xzf asdf-v${ASDF_VERSION}-linux-arm64.tar.gz \
|
||||
&& rm asdf-v${ASDF_VERSION}-linux-arm64.tar.gz \
|
||||
&& mv asdf /usr/bin/
|
||||
|
||||
|
||||
# Install Erlang and Elixir using asdf
|
||||
RUN asdf plugin add erlang \
|
||||
&& asdf plugin add elixir \
|
||||
&& asdf install erlang 26.2.1 \
|
||||
&& asdf install elixir 1.16.0 \
|
||||
&& asdf set -u erlang 26.2.1 \
|
||||
&& asdf set -u elixir 1.16.0
|
||||
|
||||
# Install Node.js using asdf
|
||||
RUN asdf plugin add nodejs \
|
||||
&& asdf install nodejs 22.1.0 \
|
||||
&& asdf set -u nodejs 22.1.0
|
||||
|
||||
ENV PATH="/root/.asdf/shims:$PATH"
|
||||
|
||||
# Install Hex and Phoenix
|
||||
RUN mix local.hex --force \
|
||||
&& mix local.rebar --force \
|
||||
&& mix archive.install hex phx_new --force
|
||||
|
||||
# custom ERL_FLAGS are passed for (public) multi-platform builds
|
||||
ARG ERL_FLAGS
|
||||
ENV ERL_FLAGS=$ERL_FLAGS
|
||||
|
||||
EXPOSE 4000
|
||||
USER root
|
||||
WORKDIR /app
|
||||
ENTRYPOINT ["mix", "phx.server"]
|
||||
47
README.md
47
README.md
@@ -52,51 +52,6 @@ Claper is proudly powered by Phoenix and Elixir.
|
||||
|
||||
You can find all the instructions and configuration in [the documentation](https://docs.claper.co/).
|
||||
|
||||
## Development environment
|
||||
|
||||
### Prerequisites
|
||||
|
||||
To run Claper on your local environment you need to have:
|
||||
|
||||
- Postgres >= 15
|
||||
- Elixir >= 1.16
|
||||
- Erlang >= 26
|
||||
- NPM >= 10
|
||||
- NodeJS >= 20
|
||||
- Ghostscript >= 9 (for PDF support)
|
||||
- Libreoffice >= 24 (for PPT/PPTX support)
|
||||
|
||||
### Installation
|
||||
|
||||
1. Clone the repo
|
||||
```sh
|
||||
git clone https://github.com/ClaperCo/Claper.git
|
||||
```
|
||||
2. Install dependencies
|
||||
```sh
|
||||
mix deps.get
|
||||
```
|
||||
3. Migrate your database
|
||||
```sh
|
||||
mix ecto.migrate
|
||||
```
|
||||
4. Install JS dependencies
|
||||
```sh
|
||||
cd assets && npm i
|
||||
```
|
||||
5. Allow execution of startup file
|
||||
```sh
|
||||
chmod +x ./start.sh
|
||||
```
|
||||
6. Start Phoenix endpoint with
|
||||
```sh
|
||||
./start.sh
|
||||
```
|
||||
|
||||
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
||||
|
||||
If you have configured `MAIL` to `local`, you can access to the mailbox at [`localhost:4000/dev/mailbox`](http://localhost:4000/dev/mailbox).
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
||||
@@ -108,7 +63,7 @@ Don't forget to give the project a star! Thanks again!
|
||||
2. Create your Feature Branch (`git checkout -b feature/amazing_feature`)
|
||||
3. Commit your Changes (`git commit -m 'Add some amazing feature'`)
|
||||
4. Push to the Branch (`git push origin feature/amazing_feature`)
|
||||
5. Open a Pull Request
|
||||
5. Open a Pull Request on the `dev` branch
|
||||
|
||||
<!-- LICENSE -->
|
||||
|
||||
|
||||
46
compose.dev.yml
Normal file
46
compose.dev.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
ports:
|
||||
- 5432:5432
|
||||
volumes:
|
||||
- "claper-db:/var/lib/postgresql/data"
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- pg_isready
|
||||
- "-q"
|
||||
- "-d"
|
||||
- "claper"
|
||||
- "-U"
|
||||
- "claper"
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
environment:
|
||||
POSTGRES_PASSWORD: claper
|
||||
POSTGRES_USER: claper
|
||||
POSTGRES_DB: claper
|
||||
networks:
|
||||
- claper-dev
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.dev
|
||||
ports:
|
||||
- 4000:4000
|
||||
volumes:
|
||||
- ".:/app"
|
||||
env_file: .env
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- claper-dev
|
||||
|
||||
volumes:
|
||||
claper-db:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
claper-dev:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user