Skip to content

Commit

Permalink
Merge pull request #20 from devgateway/OCNANDI-10-improve-dockerization
Browse files Browse the repository at this point in the history
Ocnandi 10 improve dockerization
  • Loading branch information
mpostelnicu authored Nov 15, 2023
2 parents 0217d52 + 15a5734 commit f8e9870
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ INFOBIP_KEY=452789534289
SMSGATEWAY_KEY=98459432897
SMTP_PORT=25
SMTP_HOST=host.docker.internal
SERVER_URL=http://localhost:8090
SERVER_URL=http://localhost
SPRING_DEVTOOLS_RESTART_ENABLED=false
DISABLE_EMAIL_SENDING=false
18 changes: 13 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Docker Image CI
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

jobs:

Expand All @@ -13,6 +11,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker compose build
- uses: docker/login-action@v1
with:
registry: harbor.dgstg.org
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}

- uses: actions/checkout@v3
- name: BuildAndPushDockerImages
run: |
docker build ./ --target prod -t harbor.dgstg.org/ocnandi/ocnandi-app:develop
docker push harbor.dgstg.org/ocnandi/ocnandi-app:develop
docker build ./nginx -t harbor.dgstg.org/ocnandi/ocnandi-web:develop
docker push harbor.dgstg.org/ocnandi/ocnandi-web:develop
13 changes: 12 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ version: '3.8'

services:


web:
image: ocnandi/ocnandi-web:${TAG-local}
restart: 'no'
ports:
- "80:80"
build:
context: ./nginx
depends_on:
- app

app:
image: ocportal-nandi/admin/dev:${TAG-local}
image: ocnandi/ocnandi-app:${TAG-local}
restart: 'no'
extra_hosts:
- "host.docker.internal:host-gateway" #required so docker connects to host interface (this is for sending emails)
Expand Down
12 changes: 9 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ version: '3.8'

services:

web:
image: harbor.dgstg.org/ocnandi/ocnandi-web:${TAG}
restart: always
ports:
- "80:80"ok
depends_on:
- app

app:
image: ocportal-nandi/admin/prod:${TAG-local}
image: harbor.dgstg.org/ocnandi/ocnandi-app:${TAG}
restart: always
extra_hosts:
- "host.docker.internal:host-gateway" #required so docker connects to host interface (this is for sending emails)
build:
target: prod
depends_on:
- db
- mongo
Expand Down
2 changes: 2 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx
COPY conf.d /etc/nginx/conf.d
10 changes: 10 additions & 0 deletions nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
server {
proxy_read_timeout 10m;
location / {
proxy_set_header Host $http_host;
proxy_pass http://app:8090;
proxy_redirect http://app:8090/ $scheme://$server_name/;
client_max_body_size 16M;
}
listen 80;
}
11 changes: 11 additions & 0 deletions nginx/conf.d/gzip.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Compression.
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 1;
gzip_http_version 1.1;
gzip_min_length 10;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fontobject font/opentype application/x-font-ttf;
gzip_vary on;
gzip_proxied any; # Compression for all requests.
## http://wiki.nginx.org/NginxHttpGzipModule#gzip_disable
gzip_disable msie6;

0 comments on commit f8e9870

Please sign in to comment.