From 142ede350e611ae6f2d100bd719ac7adb7d8ff5e Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Thu, 30 Jun 2022 03:24:55 +0100 Subject: [PATCH] feat: create immich-nginx container to remove default nginx config setup (#280) * feat: create immich-proxy container to remove default nginx config setup * infra: make production docker-compose point at release builds for stability * Fixed nginx config file was overriden by default.conf in nginx container; Fixed docker-compose.dev; Added additional tag 'release' for tagging after release build in Github Action Co-authored-by: Alex Tran --- .../workflows/build_push_docker_latest.yml | 27 ++++++++++++ .../workflows/build_push_docker_staging.yml | 27 ++++++++++++ .../workflows/build_push_server_release.yml | 42 +++++++++++++++++++ docker/docker-compose.dev.yml | 16 ++++--- docker/docker-compose.staging.yml | 8 ++-- docker/docker-compose.yml | 16 ++++--- nginx/Dockerfile | 3 ++ .../settings/nginx-conf => nginx}/nginx.conf | 0 8 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 nginx/Dockerfile rename {docker/settings/nginx-conf => nginx}/nginx.conf (100%) diff --git a/.github/workflows/build_push_docker_latest.yml b/.github/workflows/build_push_docker_latest.yml index e436eb60ac..98d90216f3 100644 --- a/.github/workflows/build_push_docker_latest.yml +++ b/.github/workflows/build_push_docker_latest.yml @@ -91,3 +91,30 @@ jobs: push: true tags: | altran1502/immich-web:latest + + build_and_push_nginx_latest: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and Push Proxy + uses: docker/build-push-action@v3.0.0 + with: + context: ./nginx + file: ./nginx/Dockerfile + platforms: linux/arm/v7,linux/amd64,linux/arm64 + push: true + tags: | + altran1502/immich-proxy:latest diff --git a/.github/workflows/build_push_docker_staging.yml b/.github/workflows/build_push_docker_staging.yml index 1f5347d9b8..0658ee3092 100644 --- a/.github/workflows/build_push_docker_staging.yml +++ b/.github/workflows/build_push_docker_staging.yml @@ -93,3 +93,30 @@ jobs: push: ${{ github.event_name == 'pull_request' }} tags: | altran1502/immich-web:staging + + build_and_push_nginx_staging: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and Push Proxy + uses: docker/build-push-action@v3.0.0 + with: + context: ./nginx + file: ./nginx/Dockerfile + platforms: linux/arm/v7,linux/amd64,linux/arm64 + push: ${{ github.event_name == 'pull_request' }} + tags: | + altran1502/immich-proxy:staging \ No newline at end of file diff --git a/.github/workflows/build_push_server_release.yml b/.github/workflows/build_push_server_release.yml index 8c27b84d0c..7ff6e1bfc1 100644 --- a/.github/workflows/build_push_server_release.yml +++ b/.github/workflows/build_push_server_release.yml @@ -43,6 +43,7 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: | altran1502/immich-server:${{ steps.previoustag.outputs.tag }} + altran1502/immich-server:release build_and_push_machine_learning_release: runs-on: ubuntu-latest @@ -75,6 +76,7 @@ jobs: push: true tags: | altran1502/immich-machine-learning:${{ steps.previoustag.outputs.tag }} + altran1502/immich-machine-learning:release build_and_push_web_release: runs-on: ubuntu-latest @@ -114,3 +116,43 @@ jobs: target: prod tags: | altran1502/immich-web:${{ steps.previoustag.outputs.tag }} + altran1502/immich-web:release + + build_and_push_nginx_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: "main" + fetch-depth: 0 + + - name: "Get Previous tag" + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + with: + fallback: latest + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2.0.0 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2.0.0 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push immich-proxy release + uses: docker/build-push-action@v3.0.0 + with: + context: ./web + file: ./web/Dockerfile + platforms: linux/arm/v7,linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: | + altran1502/immich-proxy:release + altran1502/immich-proxy:${{ steps.previoustag.outputs.tag }} diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml index 0e89258f48..60c766ca69 100644 --- a/docker/docker-compose.dev.yml +++ b/docker/docker-compose.dev.yml @@ -7,8 +7,6 @@ services: context: ../server dockerfile: Dockerfile command: npm run start:dev immich - expose: - - "3000" volumes: - ../server:/usr/src/app - ${UPLOAD_LOCATION}:/usr/src/app/upload @@ -27,8 +25,6 @@ services: context: ../machine-learning dockerfile: Dockerfile command: npm run start:dev - expose: - - "3001" volumes: - ../machine-learning:/usr/src/app - ${UPLOAD_LOCATION}:/usr/src/app/upload @@ -94,11 +90,12 @@ services: ports: - 5432:5432 - nginx: - container_name: proxy_nginx - image: nginx:latest - volumes: - - ./settings/nginx-conf:/etc/nginx/conf.d + immich-proxy: + container_name: immich_proxy + image: immich-proxy-dev:latest + build: + context: ../nginx + dockerfile: Dockerfile ports: - 2283:80 - 2284:443 @@ -106,6 +103,7 @@ services: driver: none depends_on: - immich-server + restart: always volumes: pgdata: diff --git a/docker/docker-compose.staging.yml b/docker/docker-compose.staging.yml index 57dab629c8..5b4780b702 100644 --- a/docker/docker-compose.staging.yml +++ b/docker/docker-compose.staging.yml @@ -68,11 +68,9 @@ services: - pgdata:/var/lib/postgresql/data restart: always - nginx: - container_name: proxy_nginx - image: nginx:latest - volumes: - - ./settings/nginx-conf:/etc/nginx/conf.d + immich-proxy: + container_name: immich_proxy + image: altran1502/immich-proxy:staging ports: - 2283:80 - 2284:443 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 38a98a41a3..e3b46ac338 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: immich-server: - image: altran1502/immich-server:latest + image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-server.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload @@ -16,7 +16,7 @@ services: restart: always immich-microservices: - image: altran1502/immich-server:latest + image: altran1502/immich-server:release entrypoint: ["/bin/sh", "./start-microservices.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload @@ -30,7 +30,7 @@ services: restart: always immich-machine-learning: - image: altran1502/immich-machine-learning:latest + image: altran1502/immich-machine-learning:release entrypoint: ["/bin/sh", "./entrypoint.sh"] volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload @@ -43,7 +43,7 @@ services: restart: always immich-web: - image: altran1502/immich-web:latest + image: altran1502/immich-web:release entrypoint: ["/bin/sh", "./entrypoint.sh"] env_file: - .env @@ -68,11 +68,9 @@ services: - pgdata:/var/lib/postgresql/data restart: always - nginx: - container_name: proxy_nginx - image: nginx:latest - volumes: - - ./settings/nginx-conf:/etc/nginx/conf.d + immich-proxy: + container_name: immich_proxy + image: altran1502/immich-proxy:release ports: - 2283:80 - 2284:443 diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000000..17db4324b3 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:latest + +COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/docker/settings/nginx-conf/nginx.conf b/nginx/nginx.conf similarity index 100% rename from docker/settings/nginx-conf/nginx.conf rename to nginx/nginx.conf