Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions for image building & support for nginx proxy configuration in env variable #7

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Publish"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on:
push:

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push Docker image for Proxy
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: ./energysmart-proxy
push: true
tags: ${{ steps.meta.outputs.tags }}-proxy
labels: ${{ steps.meta.outputs.labels }}-proxy
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ services:
restart: always
energysmart-proxy:
build: ./energysmart-proxy
environment:
- PROXY_PASS_LOCATION=energysmart-bridge:8001
ports:
- "443:443"
restart: always
4 changes: 2 additions & 2 deletions energysmart-proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM nginx:1.24

RUN apt-get update && apt-get install -y openssl

COPY nginx.conf /etc/nginx/
COPY nginx.conf.template .

RUN openssl req -nodes -new -x509 -sha1 -subj '/CN=energysmartwaterheater.com' -keyout /etc/nginx/energysmartwaterheater.com.key -out /etc/nginx/energysmartwaterheater.com.crt -days 3650

EXPOSE 443/tcp

CMD ["nginx", "-g", "daemon off;"]
CMD ["/bin/sh" , "-c" , "envsubst < /nginx.conf.template > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"]
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ events {
stream {
server {
listen 443 ssl;
proxy_pass energysmart-bridge:8001;
proxy_pass 192.168.0.241:8001;

ssl_certificate /etc/nginx/energysmartwaterheater.com.crt;
ssl_certificate_key /etc/nginx/energysmartwaterheater.com.key;
Expand Down