Merge pull request #2 from nickcoad/feature/infrastructural-improvements
fix: infra improvements
This commit is contained in:
commit
da73fcb440
6 changed files with 29 additions and 58 deletions
10
Makefile
10
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
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
ARG BUILDPLATFORM=linux/amd64
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM node:lts AS builder
|
FROM --platform=$BUILDPLATFORM node:lts AS builder
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
|
@ -30,6 +32,8 @@ COPY --from=approot / /
|
||||||
CMD ["/docker-start.sh"]
|
CMD ["/docker-start.sh"]
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
|
|
||||||
|
RUN chmod +x /docker-start.sh
|
||||||
|
|
||||||
ARG DOCKER_REPO
|
ARG DOCKER_REPO
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
ARG SOURCE_COMMIT
|
ARG SOURCE_COMMIT
|
||||||
|
|
|
@ -21,7 +21,11 @@ THREADS=4
|
||||||
BASE_URL=/
|
BASE_URL=/
|
||||||
|
|
||||||
# Directory to store image data
|
# Directory to store image data
|
||||||
MOUNT_DATA=/var/local/szurubooru/data
|
MOUNT_DATA=.szurubooru_data/data
|
||||||
|
|
||||||
# Directory to store database files
|
# 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
|
|
@ -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"
|
|
|
@ -6,6 +6,7 @@ services:
|
||||||
|
|
||||||
server:
|
server:
|
||||||
image: szurubooru/server:latest
|
image: szurubooru/server:latest
|
||||||
|
build: server
|
||||||
depends_on:
|
depends_on:
|
||||||
- sql
|
- sql
|
||||||
environment:
|
environment:
|
||||||
|
@ -24,14 +25,12 @@ services:
|
||||||
GID: ${GID}
|
GID: ${GID}
|
||||||
user: "${UID}:${GID}"
|
user: "${UID}:${GID}"
|
||||||
volumes:
|
volumes:
|
||||||
- "./server:/opt/app"
|
|
||||||
- "${MOUNT_DATA}:/data"
|
- "${MOUNT_DATA}:/data"
|
||||||
- "./server/config.yaml:/opt/app/config.yaml"
|
- "./server/config.yaml:/opt/app/config.yaml"
|
||||||
|
|
||||||
client:
|
client:
|
||||||
# image: szurubooru/client:latest
|
image: szurubooru/client:latest
|
||||||
build:
|
build: client
|
||||||
context: ./client
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
- server
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ARG ALPINE_VERSION=3.13
|
ARG ALPINE_VERSION=3.13
|
||||||
|
ARG BUILDPLATFORM=linux/amd64
|
||||||
|
|
||||||
|
FROM alpine:$ALPINE_VERSION AS prereqs
|
||||||
FROM alpine:$ALPINE_VERSION as prereqs
|
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
|
@ -37,7 +37,7 @@ COPY ./ /opt/app/
|
||||||
RUN rm -rf /opt/app/szurubooru/tests
|
RUN rm -rf /opt/app/szurubooru/tests
|
||||||
|
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM prereqs as testing
|
FROM --platform=$BUILDPLATFORM prereqs AS testing
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
|
@ -61,7 +61,7 @@ ENTRYPOINT ["pytest", "--tb=short"]
|
||||||
CMD ["szurubooru/"]
|
CMD ["szurubooru/"]
|
||||||
|
|
||||||
|
|
||||||
FROM prereqs as release
|
FROM prereqs AS release
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
|
|
||||||
ARG PUID=1000
|
ARG PUID=1000
|
||||||
|
@ -79,6 +79,8 @@ RUN apk --no-cache add \
|
||||||
USER app
|
USER app
|
||||||
CMD ["/opt/app/docker-start.sh"]
|
CMD ["/opt/app/docker-start.sh"]
|
||||||
|
|
||||||
|
RUN chmod +x /opt/app/docker-start.sh
|
||||||
|
|
||||||
ARG PORT=6666
|
ARG PORT=6666
|
||||||
ENV PORT=${PORT}
|
ENV PORT=${PORT}
|
||||||
EXPOSE ${PORT}
|
EXPOSE ${PORT}
|
||||||
|
|
Reference in a new issue