Skip to content

Commit 26f039a

Browse files
committed
Add exposed port env
1 parent 83858b8 commit 26f039a

File tree

6 files changed

+28
-9
lines changed

6 files changed

+28
-9
lines changed

.github/workflows/dev.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ jobs:
1313
- name: Checkout Source Code
1414
uses: actions/checkout@v2
1515
- name: Build Docker images
16-
run: TAG=dev docker-compose build
16+
env:
17+
TAG: dev
18+
EXPOSED_PORT: 8443
19+
run: docker-compose build
1720
- name: Login to GitHub Container Registry
1821
uses: docker/login-action@v1
1922
with:
2023
registry: ghcr.io
2124
username: ${{ github.actor }}
2225
password: ${{ secrets.GITHUB_TOKEN }}
2326
- name: Push images to GitHub Container Registry
24-
run: TAG=dev docker-compose push
27+
env:
28+
TAG: dev
29+
run: docker-compose push

.github/workflows/main.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ jobs:
1313
- name: Checkout Source Code
1414
uses: actions/checkout@v2
1515
- name: Build Docker images
16-
run: TAG=latest docker-compose build
16+
env:
17+
TAG: latest
18+
EXPOSED_PORT: 443
19+
run: docker-compose build
1720
- name: Login to GitHub Container Registry
1821
uses: docker/login-action@v1
1922
with:
2023
registry: ghcr.io
2124
username: ${{ github.actor }}
2225
password: ${{ secrets.GITHUB_TOKEN }}
2326
- name: Push images to GitHub Container Registry
24-
run: TAG=latest docker-compose push
27+
env:
28+
TAG: latest
29+
run: docker-compose push

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
# Certificate
55
*.pem
66
*.crt
7-
*.der
7+
*.der
8+
9+
# Misc
10+
.env

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
FROM nginx:1.20.2
2-
ADD nginx.conf /etc/nginx/
3-
EXPOSE 443
2+
COPY nginx.conf /etc/nginx/
3+
ARG EXPOSED_PORT=443
4+
ENV EXPOSED_PORT $EXPOSED_PORT
5+
RUN envsubst '\$EXPOSED_PORT' < /etc/nginx/nginx.conf | tee /etc/nginx/nginx.conf
6+
EXPOSE 443

docker-compose.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ version: '3.8'
22
services:
33
nginx:
44
image: ghcr.io/opexdev/nginx:$TAG
5-
build: .
5+
build:
6+
context: .
7+
args:
8+
- EXPOSED_PORT=$EXPOSED_PORT

nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ http {
7676
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
7777
proxy_set_header X-Forwarded-Proto $scheme;
7878
proxy_set_header X-Forwarded-Host $server_name;
79-
proxy_set_header X-Forwarded-Port 8443;
79+
proxy_set_header X-Forwarded-Port $EXPOSED_PORT;
8080

8181
server {
8282
listen 443 ssl;

0 commit comments

Comments
 (0)