This commit is contained in:
Alex Lion
2025-07-03 10:44:15 +02:00
parent 10fb9611ad
commit cf7eb77ce2
5 changed files with 139 additions and 53 deletions

View File

@@ -45,15 +45,13 @@ jobs:
- name: Build and push Docker image
# You may pin to the exact commit or the version.
# uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v2.10.0
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BUILD_METADATA=${{ steps.meta.outputs.json }}
ERL_FLAGS=+JPperf true

View File

@@ -1,2 +0,0 @@
erlang 26.2.5.6
elixir 1.18.0-otp-26

92
Dockerfile.dev Normal file
View File

@@ -0,0 +1,92 @@
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 \
ghostscript \
libreoffice \
&& 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 ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
ASDF_ARCH="arm64"; \
else \
ASDF_ARCH="amd64"; \
fi && \
wget https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-${ASDF_ARCH}.tar.gz \
&& tar -xzf asdf-v${ASDF_VERSION}-linux-${ASDF_ARCH}.tar.gz \
&& rm asdf-v${ASDF_VERSION}-linux-${ASDF_ARCH}.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 ["bash", "-c", "mix deps.get && mix ecto.migrate && cd assets && npm i && cd .. && mix phx.server"]

View File

@@ -45,58 +45,11 @@ Claper is proudly powered by Phoenix and Elixir.
### Our partners and sponsors
<a href="https://www.lmddc.lu/"><img src="priv/static/images/partners/lmddc.png" alt="LMDDC" height="50"></a>
<a href="https://www.pixilearn.fr/en/"><img src="priv/static/images/partners/pixilearn.png" alt="Pixilearn" height="50"></a>
<a href="https://www.uccs.edu/"><img src="priv/static/images/partners/uccs.png" alt="UCCS" height="50"></a>
## Documentation
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 +61,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 -->

45
compose.dev.yml Normal file
View File

@@ -0,0 +1,45 @@
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
networks:
- claper-dev
volumes:
claper-db:
driver: local
networks:
claper-dev:
driver: bridge