Set Nginx port from variable (#59)
* Set Nginx port from a variable * Add latest tag only from tags and default branch
This commit is contained in:
parent
11b44ce8be
commit
e988a0ecfe
|
@ -23,4 +23,6 @@ jobs:
|
|||
build-and-push:
|
||||
name: Build and Push
|
||||
uses: ./.github/workflows/docker-reusable.yml
|
||||
with:
|
||||
tag_latest: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }}
|
||||
secrets: inherit
|
||||
|
|
|
@ -5,6 +5,7 @@ ARG APP_USER=root
|
|||
ARG BUILD_HOME=/app
|
||||
ARG BUILD_OUT=dist
|
||||
ARG APP_HOME=${BUILD_HOME}
|
||||
ARG APP_PORT=${APP_PORT:-80}
|
||||
ARG NGINX_TEMPLATE=docker/default.conf.template
|
||||
ARG VITE_CODEX_API_URL=${VITE_CODEX_API_URL:-http://127.0.0.1:8080}
|
||||
ARG VITE_GEO_IP_URL=${VITE_GEO_IP_URL:-http://127.0.0.1:8080}
|
||||
|
@ -32,6 +33,7 @@ ARG APP_USER
|
|||
ARG BUILD_HOME
|
||||
ARG BUILD_OUT
|
||||
ARG APP_HOME
|
||||
ARG APP_PORT
|
||||
ARG NGINX_TEMPLATE
|
||||
|
||||
WORKDIR ${APP_HOME}
|
||||
|
@ -40,5 +42,6 @@ COPY ${NGINX_TEMPLATE} /etc/nginx/templates
|
|||
COPY --chown=${APP_USER}:${APP_USER} --from=builder ${BUILD_HOME}/${BUILD_OUT} .
|
||||
|
||||
ENV APP_HOME=${APP_HOME}
|
||||
ENV APP_PORT=${APP_PORT}
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE ${APP_PORT}
|
||||
|
|
|
@ -46,3 +46,14 @@
|
|||
```
|
||||
|
||||
Access UI on http://localhost:3000.
|
||||
|
||||
And we also can set Nginx custom port using `APP_PORT` variable. That is useful when use the `host` network mode for a container
|
||||
```shell
|
||||
docker run \
|
||||
--rm \
|
||||
--name codex-marketplace-ui \
|
||||
--net=host \
|
||||
-e 'APP_PORT=3000' \
|
||||
-p 3000:3000 \
|
||||
codexstorage/codex-marketplace-ui:latest
|
||||
```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
server {
|
||||
listen 80;
|
||||
listen ${APP_PORT};
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
|
|
Loading…
Reference in New Issue