diff --git a/Makefile b/Makefile index e69de29b..b6604ad2 100644 --- a/Makefile +++ b/Makefile @@ -0,0 +1,10 @@ +dc-up: + docker compose up -d + +dc-down: + docker compose down --volumes + +dc-reset: + make dc-down + make dc-up + diff --git a/client/Dockerfile b/client/Dockerfile index 701e39f0..399367e0 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,3 +1,5 @@ +ARG BUILDPLATFORM=linux/amd64 + FROM --platform=$BUILDPLATFORM node:lts AS builder WORKDIR /opt/app @@ -30,6 +32,8 @@ COPY --from=approot / / CMD ["/docker-start.sh"] VOLUME ["/data"] +RUN chmod +x /docker-start.sh + ARG DOCKER_REPO ARG BUILD_DATE ARG SOURCE_COMMIT diff --git a/doc/example.env b/doc/example.env index 303a25e6..6d21ef15 100644 --- a/doc/example.env +++ b/doc/example.env @@ -21,7 +21,11 @@ THREADS=4 BASE_URL=/ # Directory to store image data -MOUNT_DATA=/var/local/szurubooru/data +MOUNT_DATA=.szurubooru_data/data # Directory to store database files -MOUNT_SQL=/var/local/szurubooru/sql +MOUNT_SQL=.szurubooru_data/sql + +# User ID and Group ID to use in the containers +UID=$UID +GID=$GID \ No newline at end of file diff --git a/docker-compose.local.yml b/docker-compose.local.yml deleted file mode 100644 index 9c26f002..00000000 --- a/docker-compose.local.yml +++ /dev/null @@ -1,48 +0,0 @@ -## Example Docker Compose configuration -## -## Use this as a template to set up docker-compose, or as guide to set up other -## orchestration services -version: '2' - -services: - - server: - image: szurubooru/server:latest - depends_on: - - sql - environment: - ## These should be the names of the dependent containers listed below, - ## or FQDNs/IP addresses if these services are running outside of Docker - POSTGRES_HOST: sql - ## Credentials for database: - POSTGRES_USER: - POSTGRES_PASSWORD: - ## Commented Values are Default: - #POSTGRES_DB: defaults to same as POSTGRES_USER - #POSTGRES_PORT: 5432 - #LOG_SQL: 0 (1 for verbose SQL logs) - THREADS: - volumes: - - "${MOUNT_DATA}:/data" - - "./server/config.yaml:/opt/app/config.yaml" - - client: - image: szurubooru/client:latest - depends_on: - - server - environment: - BACKEND_HOST: server - BASE_URL: - volumes: - - "${MOUNT_DATA}:/data:ro" - ports: - - "${PORT}:80" - - sql: - image: postgres:11-alpine - restart: unless-stopped - environment: - POSTGRES_USER: szuru - POSTGRES_PASSWORD: changeme - volumes: - - "${MOUNT_SQL}:/var/lib/postgresql/data" diff --git a/docker-compose.yml b/docker-compose.yml index 0d463884..4e383425 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: server: image: szurubooru/server:latest + build: server depends_on: - sql environment: @@ -24,14 +25,12 @@ services: GID: ${GID} user: "${UID}:${GID}" volumes: - - "./server:/opt/app" - "${MOUNT_DATA}:/data" - "./server/config.yaml:/opt/app/config.yaml" client: - # image: szurubooru/client:latest - build: - context: ./client + image: szurubooru/client:latest + build: client depends_on: - server environment: diff --git a/server/Dockerfile b/server/Dockerfile index 3e4dadfb..2927261d 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,7 +1,7 @@ ARG ALPINE_VERSION=3.13 +ARG BUILDPLATFORM=linux/amd64 - -FROM alpine:$ALPINE_VERSION as prereqs +FROM alpine:$ALPINE_VERSION AS prereqs WORKDIR /opt/app RUN apk --no-cache add \ @@ -37,7 +37,7 @@ COPY ./ /opt/app/ RUN rm -rf /opt/app/szurubooru/tests -FROM --platform=$BUILDPLATFORM prereqs as testing +FROM --platform=$BUILDPLATFORM prereqs AS testing WORKDIR /opt/app RUN apk --no-cache add \ @@ -61,7 +61,7 @@ ENTRYPOINT ["pytest", "--tb=short"] CMD ["szurubooru/"] -FROM prereqs as release +FROM prereqs AS release WORKDIR /opt/app ARG PUID=1000 @@ -79,6 +79,8 @@ RUN apk --no-cache add \ USER app CMD ["/opt/app/docker-start.sh"] +RUN chmod +x /opt/app/docker-start.sh + ARG PORT=6666 ENV PORT=${PORT} EXPOSE ${PORT}