Skip to content

Commit

Permalink
Merge pull request #305 from AliMD/feat/nginx
Browse files Browse the repository at this point in the history
Fix(nginx): healthcheck, workdir, publish versions
  • Loading branch information
alimd authored Sep 27, 2022
2 parents 4f17f3c + 320e10a commit 0fb6413
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
description: High performance, optimized NGINX for server web applications and api proxy with fast cache.
version:
short: 1
full: 1.23
full: 1.0.0-1.23-alpine
- image: tdlib
description: Cross-platform library for building Telegram clients.
version:
Expand Down
3 changes: 2 additions & 1 deletion packages/container/nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ ENV NGINX_ERROR_LOG_LEVEL=notice \
NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE=1

RUN apk add --no-cache curl
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD curl -fso /dev/null http://localhost/server-info || exit 1
HEALTHCHECK --interval=30s --timeout=3s --start-period=1s --retries=3 CMD curl -fso /dev/null http://localhost/server-info || exit 1

RUN rm -rfv /etc/nginx/conf.d/*
COPY conf/ /etc/nginx/
COPY www/ /var/www/

EXPOSE 80
WORKDIR /var/www/html/
ENTRYPOINT ["/etc/nginx/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
30 changes: 30 additions & 0 deletions packages/container/nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,33 @@ High performance, optimized NGINX for server web applications and api proxy with
## Cloud Native Application Best Practices

The right way of using `@alwatr/nginx` is behind kubernetes ingress or simple edge reverse-proxy, then don't config edge stuff like gzip compression, ssl, etc or even config domain or multi websites!

## Usage

### Pull image from the command line

```sh
docker pull ghcr.io/alimd/nginx:1
```

### Use as base image in Dockerfile

```Dockerfile
FROM ghcr.io/alimd/nginx:1
```

#### PWA Dockerfile Sample

```Dockerfile
ARG NODE_VERSION=lts
FROM node:${NODE_VERSION} as build-deps
WORKDIR /app
COPY package.json *.lock .
RUN yarn install --frozen-lockfile --non-interactive && yarn cache clean
COPY . .
RUN yarn build

ARG ALWATR_NGINX_VERSION=1
FROM ghcr.io/alimd/nginx:${ALWATR_NGINX_VERSION}
COPY --from=build-deps /app/dist/ .
```

0 comments on commit 0fb6413

Please sign in to comment.