Skip to content

Commit

Permalink
Add exposed port env
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrahimmfadae committed May 20, 2022
1 parent 83858b8 commit 26f039a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ jobs:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Build Docker images
run: TAG=dev docker-compose build
env:
TAG: dev
EXPOSED_PORT: 8443
run: docker-compose build
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to GitHub Container Registry
run: TAG=dev docker-compose push
env:
TAG: dev
run: docker-compose push
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ jobs:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Build Docker images
run: TAG=latest docker-compose build
env:
TAG: latest
EXPOSED_PORT: 443
run: docker-compose build
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to GitHub Container Registry
run: TAG=latest docker-compose push
env:
TAG: latest
run: docker-compose push
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
# Certificate
*.pem
*.crt
*.der
*.der

# Misc
.env
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FROM nginx:1.20.2
ADD nginx.conf /etc/nginx/
EXPOSE 443
COPY nginx.conf /etc/nginx/
ARG EXPOSED_PORT=443
ENV EXPOSED_PORT $EXPOSED_PORT
RUN envsubst '\$EXPOSED_PORT' < /etc/nginx/nginx.conf | tee /etc/nginx/nginx.conf
EXPOSE 443
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ version: '3.8'
services:
nginx:
image: ghcr.io/opexdev/nginx:$TAG
build: .
build:
context: .
args:
- EXPOSED_PORT=$EXPOSED_PORT
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port 8443;
proxy_set_header X-Forwarded-Port $EXPOSED_PORT;

server {
listen 443 ssl;
Expand Down

0 comments on commit 26f039a

Please sign in to comment.