Commit 155e50fa authored by Dmitriy Safronov's avatar Dmitriy Safronov
Browse files

0.4.0 cache &websockets

parent f1b95b86
Loading
Loading
Loading
Loading
+104 −0
Original line number Diff line number Diff line
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
  push:
    branches: [ master ]
    # Publish semver tags as releases.
    tags: [ 'v*.*.*' ]
  pull_request:
    branches: [ master ]

env:
  # Use docker.io for Docker Hub if empty
  REGISTRY: ghcr.io
  # github.repository as <account>/<repo>
  IMAGE_NAME: ${{ github.repository }}


jobs:
  build:

    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
      # This is used to complete the identity challenge
      # with sigstore/fulcio when running outside of PRs.
      id-token: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      # # https://github.com/docker/setup-qemu-action
      # - name: Set up QEMU
      #   uses: docker/setup-qemu-action@v2.0.0

      # https://github.com/docker/setup-buildx-action
      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v2.0.0

      # Login against a Docker registry except on PR
      # https://github.com/docker/login-action
      - name: Log into registry ${{ env.REGISTRY }}
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v2.0.0
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      # Extract metadata (tags, labels) for Docker
      # https://github.com/docker/metadata-action
      - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@v4.0.1
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}

      # Cache dependencies
      # https://github.com/actions/cache
      - name: Cache Docker layers
        uses: actions/cache@v3.0.5
        with:
          path: /tmp/.buildx-cache
          key: ${{ runner.os }}-multi-buildx-${{ github.sha }}
          restore-keys: |
            ${{ runner.os }}-multi-buildx

      # Build and push Docker image with Buildx (don't push on PR)
      # https://github.com/docker/build-push-action
      - name: Build and push Docker image
        id: build-and-push
        uses: docker/build-push-action@v3.1.0
        with:
          context: .
          # platforms: linux/amd64,linux/arm64,linux/arm/v7
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=local,src=/tmp/.buildx-cache
          # Note the mode=max here
          # More: https://github.com/moby/buildkit#--export-cache-options
          # And: https://github.com/docker/buildx#--cache-tonametypetypekeyvalue
          cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

      # Temp fix / Disabled on self-hosted runner
      # https://github.com/docker/build-push-action/issues/252
      # https://github.com/moby/buildkit/issues/1896
      - name: Move cache
        run: |
          rm -rf /tmp/.buildx-cache
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+14 −4
Original line number Diff line number Diff line
# `nginx-sidecar` changelog
# `nginx-sidecar` changelog

## 0.4.0

- Enabling the support of caching and websockets
- Some variables were renamed, see `entrypoint.sh`
- New variables are:
  - `NGINX_CLIENT_BODY_BUFFER_SIZE` - it sets client_body_buffer_size (default: 8k).
  - `NGINX_CLIENT_MAX_BODY_SIZE` - it sets client_max_body_size (default: 5M).
  - `APP_SCHEME` - it sets application scheme (default: http).
  - `NGINX_PROXY_BUFFER_SIZE` - it sets proxy_buffer_size (default: 8k).

## 0.3.8

- Enabling the support of custom timeout for proxy requests
- New variable is: PROXY_TIMEOUT- it sets proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout values. (default: 60s)
- New variable is: `PROXY_TIMEOUT` - it sets proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout values. (default: 60s)

## 0.3.7

+14 −5
Original line number Diff line number Diff line
FROM nginx:stable

RUN apt update && apt install -y curl
# # Install dependencies
# ARG DEPENDENCIES="curl"
# RUN apt-get update -y && \
#     apt-get install --no-install-recommends -y ${DEPENDENCIES} && \
#     apt-get clean && \
#     rm -rf /var/cache/apt/archives/* && \
#     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
#     truncate -s 0 /var/log/*log

COPY nginx.conf.template /etc/nginx/nginx.conf.template
COPY start.sh /usr/bin/start.sh
RUN chmod a+x /usr/bin/start.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod a+x /entrypoint.sh && \
    mkdir -p /usr/local/etc/nginx

CMD /usr/bin/start.sh
COPY *.conf.template /usr/local/etc/nginx/

ENTRYPOINT ["/entrypoint.sh"]
+5 −5
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@ A simple nginx reverse proxy side-car, which can be placed in front an applicati

## Requirements

 - The application must be linked (either by Docker `--link` or ECS `links` section) as `app`.
 - The `NGINX_PORT` environment variable should be set to the port nginx should bind to.
 - The `APP_PORT` environment variable should be set to the port that the application is bound to inside the `app` container.
 - The application must be linked (either by Docker `--link` or ECS `links` section) as `app` either the `APP_HOST` environment variable must be set to the service name.
 - The `NGINX_PORT` (default `80`) environment variable should be set to the port nginx should bind to.
 - The `APP_PORT` (default `8080`) environment variable should be set to the port that the application is bound to inside the `app` container.

## Stats Monitoring

@@ -15,7 +15,7 @@ We've enabled `http_stub_status_module` access to help with monitoring integrati
- `NGINX_STATUS_ALLOW_FROM` (default `all`) IP, CIDR, `all` for the nginx config's `allow` statement (http://nginx.org/en/docs/http/ngx_http_access_module.html)

## Optional Requirements
 - PROXY_TIMEOUT sets proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout values. (default: 60s)
 - NGINX_PROXY_TIMEOUT sets proxy_connect_timeout, proxy_send_timeout, proxy_read_timeout values. (default: 60s)

## Example

@@ -69,7 +69,7 @@ services:
        - name: NGINX_STATUS_ALLOW_FROM
          value: '172.0.0.0/8'
        # If you want a custom timeout for the request
        - name: PROXY_TIMEOUT
        - name: NGINX_PROXY_TIMEOUT
          value: '10s'
        
        # If your datadog agent has Autodiscovery enabled, you can provide additional docker labels
+1 −1
Original line number Diff line number Diff line
0.3.8
0.4.0
Loading