2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-01 01:59:58 +00:00

Adding a prod docker and docker-compose.

This commit is contained in:
Dessalines 2020-06-07 16:43:04 -04:00
parent 15cf50e3b1
commit 9ff134e616
7 changed files with 63 additions and 4 deletions

View file

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

2
.gitignore vendored
View file

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

View file

@ -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 $ ./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 ### API
pict-rs offers four endpoints: pict-rs offers four endpoints:
- `POST /image` for uploading an image. Uploaded content must be valid multipart/form-data with an - `POST /image` for uploading an image. Uploaded content must be valid multipart/form-data with an

28
docker/dev/deploy.sh Normal file
View file

@ -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

View file

@ -3,8 +3,8 @@ version: '3.3'
services: services:
pictrs: pictrs:
build: build:
context: ../ context: ../../
dockerfile: docker/Dockerfile dockerfile: docker/dev/Dockerfile
user: root user: root
ports: ports:
- "127.0.0.1:8080:8080" - "127.0.0.1:8080:8080"

View file

@ -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