diff --git a/.dockerignore b/.dockerignore index da63f55..2739723 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ target .git -docker/volumes +docker/dev/volumes diff --git a/.gitignore b/.gitignore index e967360..b95ca4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /target /data -/docker/volumes +/docker/dev/volumes diff --git a/README.md b/README.md index 05f32c0..a6e80d7 100644 --- a/README.md +++ b/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 diff --git a/docker/Dockerfile b/docker/dev/Dockerfile similarity index 100% rename from docker/Dockerfile rename to docker/dev/Dockerfile diff --git a/docker/dev/deploy.sh b/docker/dev/deploy.sh new file mode 100644 index 0000000..716f944 --- /dev/null +++ b/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 diff --git a/docker/docker-compose.yml b/docker/dev/docker-compose.yml similarity index 77% rename from docker/docker-compose.yml rename to docker/dev/docker-compose.yml index 329fa34..a19c019 100644 --- a/docker/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -3,8 +3,8 @@ version: '3.3' services: pictrs: build: - context: ../ - dockerfile: docker/Dockerfile + context: ../../ + dockerfile: docker/dev/Dockerfile user: root ports: - "127.0.0.1:8080:8080" diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml new file mode 100644 index 0000000..d73cbf5 --- /dev/null +++ b/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