Browse Source

Adding a prod docker and docker-compose.

v0.1.x
Dessalines 2 years ago
parent
commit
9ff134e616
  1. 2
      .dockerignore
  2. 2
      .gitignore
  3. 18
      README.md
  4. 0
      docker/dev/Dockerfile
  5. 28
      docker/dev/deploy.sh
  6. 4
      docker/dev/docker-compose.yml
  7. 13
      docker/prod/docker-compose.yml

2
.dockerignore

@ -1,3 +1,3 @@
target
.git
docker/volumes
docker/dev/volumes

2
.gitignore

@ -1,3 +1,3 @@
/target
/data
/docker/volumes
/docker/dev/volumes

18
README.md

@ -35,6 +35,24 @@ Running locally, port 8080, storing data in data/, and only allowing the `thumbn
$ ./pict-rs -a 127.0.0.1:8080 -p data/ -w thumbnail identity
```
#### Docker
Run the following commands:
```
# Create a folder for the files (anywhere works)
mkdir /pict-rs
cd /pict-rs
wget https://git.asonix.dog/asonix/pict-rs/raw/branch/master/docker/prod/docker-compose.yml
sudo docker-compose up -d
```
#### Docker Development
Run the following to develop in docker:
```
git clone https://git.asonix.dog/asonix/pict-rs
cd pict-rs/docker/dev
docker-compose up --build
```
### API
pict-rs offers four endpoints:
- `POST /image` for uploading an image. Uploaded content must be valid multipart/form-data with an

docker/Dockerfile → docker/dev/Dockerfile

28
docker/dev/deploy.sh

@ -0,0 +1,28 @@
# To deploy, run ./deploy [tag]
#!/bin/sh
git checkout master
# Creating the new tag
new_tag="$1"
# Changing the docker-compose prod
sed -i "s/asonix\/pictrs:.*/asonix\/pictrs:$new_tag/" ../prod/docker-compose.yml
git add ../prod/docker-compose.yml
# The commit
git commit -m"Version $new_tag"
git tag $new_tag
# Rebuilding docker
docker-compose build
docker tag dev_pictrs:latest asonix/pictrs:x64-$new_tag
docker push asonix/pictrs:x64-$new_tag
# Build for Raspberry Pi / other archs
# TODO
docker manifest push asonix/pictrs:$new_tag
# Push
git push origin $new_tag
git push

docker/docker-compose.yml → docker/dev/docker-compose.yml

13
docker/prod/docker-compose.yml

@ -0,0 +1,13 @@
version: '3.3'
services:
pictrs:
image: asonix/pictrs:v0.0.1
user: root
ports:
- "127.0.0.1:8080:8080"
restart: always
environment:
- PICTRS_PATH=/app/data
volumes:
- ./volumes/pictrs:/app/data
Loading…
Cancel
Save