Small Docker fixes & features (#68)

* Fix permission error creating a file/folder in the upload folder

* Fix first startup. Add postgress healthcheck and make it a required dpendency for the start of the app container

* Add  to easy test new features and build a local Docker image
This commit is contained in:
joleaf
2023-10-29 14:38:52 +01:00
committed by GitHub
parent 0e9b050308
commit 697b546044
4 changed files with 58 additions and 3 deletions

View File

@@ -99,7 +99,7 @@ RUN mkdir /home/nobody && chown nobody /home/nobody
WORKDIR "/app" WORKDIR "/app"
RUN mkdir /app/uploads RUN mkdir /app/uploads
RUN chown nobody /app RUN chown -R nobody /app
# Only copy the final release from the build stage # Only copy the final release from the build stage
COPY --from=builder --chown=nobody:root /app/_build/prod/rel/claper ./ COPY --from=builder --chown=nobody:root /app/_build/prod/rel/claper ./

View File

@@ -113,9 +113,21 @@ A Docker Compose [reference file](https://github.com/ClaperCo/Claper/blob/main/d
```sh ```sh
git clone https://github.com/ClaperCo/Claper.git git clone https://github.com/ClaperCo/Claper.git
cd Claper cd Claper
docker-compose up docker compose up
``` ```
### Using Docker Compose for Dev
To easy check new features, it is possible to directly build the Docker image from the source code and run the container with the [docker-compose-dev.yml](https://github.com/ClaperCo/Claper/blob/main/docker-compose-dev.yml) file.
```sh
git clone https://github.com/ClaperCo/Claper.git
cd Claper
docker compose -f docker-compose-dev.yml up
```
<!-- CONTRIBUTING --> <!-- CONTRIBUTING -->
## Contributing ## Contributing

37
docker-compose-dev.yml Normal file
View File

@@ -0,0 +1,37 @@
version: "3.0"
services:
db:
image: postgres:9
ports:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: claper
POSTGRES_USER: claper
POSTGRES_DB: claper
healthcheck:
test: ["CMD-SHELL", "pg_isready -U claper"]
interval: 5s
timeout: 5s
retries: 10
app:
build: .
ports:
- 4000:4000
volumes:
- uploads:/app/uploads
environment:
DATABASE_URL: postgres://claper:claper@db:5432/claper
SECRET_KEY_BASE: 0LZiQBLw4WvqPlz4cz8RsHJlxNiSqM9B48y4ChyJ5v1oA0L/TPIqRjQNdPZN3iEG
MAIL_TRANSPORT: local
ENDPOINT_PORT: 4000
PRESENTATION_STORAGE: local
MAX_FILE_SIZE_MB: 15
ENABLE_ACCOUNT_CREATION: true
depends_on:
db:
condition: service_healthy
volumes:
postgres-data:
uploads:

View File

@@ -10,6 +10,11 @@ services:
POSTGRES_PASSWORD: claper POSTGRES_PASSWORD: claper
POSTGRES_USER: claper POSTGRES_USER: claper
POSTGRES_DB: claper POSTGRES_DB: claper
healthcheck:
test: ["CMD-SHELL", "pg_isready -U claper"]
interval: 5s
timeout: 5s
retries: 10
app: app:
image: ghcr.io/claperco/claper:latest image: ghcr.io/claperco/claper:latest
ports: ports:
@@ -25,6 +30,7 @@ services:
MAX_FILE_SIZE_MB: 15 MAX_FILE_SIZE_MB: 15
ENABLE_ACCOUNT_CREATION: true ENABLE_ACCOUNT_CREATION: true
depends_on: depends_on:
- db db:
condition: service_healthy
volumes: volumes:
uploads: uploads: