diff --git a/backend/Dockerfile b/backend/Dockerfile index 8dcf9ebb9..4148a1dbf 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -19,15 +19,6 @@ LABEL maintainer="mathieu.brunot at monogramm dot io" # Add uxbox as provided by builder COPY --from=0 /home/uxbox/backend/dist/uxbox-backend.jar /srv/uxbox/app.jar -VOLUME /srv/uxbox/resources/public - -WORKDIR /srv/uxbox/ - -RUN set -ex; \ - mkdir -p /srv/uxbox/resources/public/media; \ - mkdir -p /srv/uxbox/resources/public/static; - - ENV UXBOX_HTTP_SERVER_DEBUG=false \ UXBOX_DATABASE_USERNAME=uxbox \ UXBOX_DATABASE_PASSWORD=youshouldoverwritethiswithsomethingelse \ @@ -43,7 +34,18 @@ ENV UXBOX_HTTP_SERVER_DEBUG=false \ UXBOX_SMTP_SSL=false \ UXBOX_SMTP_TLS=false \ UXBOX_SMTP_ENABLED=false \ - UXBOX_SECRET=youshouldoverwritethiswithsomethingelse + UXBOX_SECRET=youshouldoverwritethiswithsomethingelse + +COPY docker-entrypoint.sh /entrypoint.sh + +RUN set -ex; \ + chmod 755 /entrypoint.sh; \ + mkdir -p /srv/uxbox/resources/public/media; \ + mkdir -p /srv/uxbox/resources/public/static; + +VOLUME /srv/uxbox/resources/public + +WORKDIR /srv/uxbox/ EXPOSE 6060 diff --git a/docker-compose.yml b/docker-compose.yml index d4aab6acc..e33814efd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,14 @@ version: '2' volumes: - uxbox_front: - uxbox_back: - uxbox_db: + frontend_data: + backend_data: + db_data: services: db: image: postgres:latest + container_name: db restart: always ports: - "5432:5432" @@ -16,11 +17,12 @@ services: - "POSTGRES_USER=uxbox" - "POSTGRES_PASSWORD=uxbox_postgres_password" volumes: - - uxbox_db:/var/lib/postgresql/data + - db_data:/var/lib/postgresql/data - backend: + uxbackend: build: ./backend #image: monogramm/uxbox:backend + container_name: uxbackend #restart: always depends_on: - db @@ -48,14 +50,24 @@ services: - "UXBOX_SMTP_ENABLED=false" # Security setup - "UXBOX_SECRET=youshouldoverwritethiswithsomethingelse" + volumes: + - /srv/uxbox/backend/resources:/srv/uxbox/resources + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro - frontend: + uxfrontend: build: ./frontend #image: monogramm/uxbox:frontend + container_name: frontend + #hostname: uxbox.${DOMAIN} #restart: always depends_on: - - backend + - uxbackend ports: - 80:80 environment: - - "API_URL=http://127.0.0.1:6060/api" + #- "API_URL=http://uxbox.${DOMAIN}/api/" + volumes: + #- /srv/uxbox/frontend/html:/usr/share/nginx/html + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro diff --git a/frontend/docker-nginx/conf.d/default.conf b/frontend/docker-nginx/conf.d/default.conf index 1c5a528e8..814109134 100644 --- a/frontend/docker-nginx/conf.d/default.conf +++ b/frontend/docker-nginx/conf.d/default.conf @@ -3,7 +3,7 @@ upstream backend { # server api1.my.uxbox.com:3000; # server api1.my.uxbox.com:3001; # server api2.my.uxbox.com:3000; - server uxbox_backend:6060; # This is a circular reference that allows docker to start as the example project, it is not recommended to use this in actual development. + server uxbackend:6060; # This is a circular reference that allows docker to start as the example project, it is not recommended to use this in actual development. } server {