-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:NetCoreTemplates/nextjs
- Loading branch information
Showing
7 changed files
with
106 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
sed -i "s/\$DEPLOY_API/${deploy_api}/g" ./ui/next.config.js | ||
sed -i "s/\$DEPLOY_API/${deploy_api}/g" ./ui/next.config.mjs | ||
[[ -f ./ui/post.build.js ]] && sed -i "s/\$DEPLOY_API/${deploy_api}/g;s/\$DEPLOY_CDN/${deploy_cdn}/g" ./ui/post.build.js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
version: '2' | ||
version: "3.9" | ||
|
||
services: | ||
nginx-proxy: | ||
image: jwilder/nginx-proxy | ||
image: nginxproxy/nginx-proxy | ||
container_name: nginx-proxy | ||
restart: always | ||
ports: | ||
|
@@ -15,26 +15,32 @@ services: | |
- dhparam:/etc/nginx/dhparam | ||
- certs:/etc/nginx/certs:ro | ||
- /var/run/docker.sock:/tmp/docker.sock:ro | ||
network_mode: bridge | ||
labels: | ||
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" | ||
|
||
letsencrypt: | ||
image: jrcs/letsencrypt-nginx-proxy-companion:2.0 | ||
image: nginxproxy/acme-companion:2.2 | ||
container_name: nginx-proxy-le | ||
restart: always | ||
depends_on: | ||
- "nginx-proxy" | ||
environment: | ||
- [email protected] | ||
volumes_from: | ||
- nginx-proxy | ||
volumes: | ||
- certs:/etc/nginx/certs:rw | ||
- acme:/etc/acme.sh | ||
- vhost:/etc/nginx/vhost.d | ||
- html:/usr/share/nginx/html | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
network_mode: bridge | ||
|
||
networks: | ||
default: | ||
name: nginx | ||
|
||
volumes: | ||
conf: | ||
vhost: | ||
html: | ||
dhparam: | ||
certs: | ||
acme: | ||
acme: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ jobs: | |
working-directory: ./ui | ||
|
||
# Assign environment variables used in subsequent steps | ||
- name: repository name fix | ||
- name: Env variable assignment | ||
run: echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
# TAG_NAME defaults to 'latest' if not a release or manual deployment | ||
- name: Assign version | ||
|
@@ -75,14 +75,13 @@ jobs: | |
echo "TAG_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV | ||
fi; | ||
# Authenticate, build and push to GitHub Container Registry (ghcr.io) | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and push new docker image, skip for manual redeploy other than 'latest' | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v3 | ||
|
@@ -120,7 +119,6 @@ jobs: | |
with: | ||
ref: refs/tags/${{ github.event.inputs.version }} | ||
|
||
# Assign environment variables used in subsequent steps | ||
- name: repository name fix and env | ||
run: | | ||
echo "image_repository_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
@@ -132,31 +130,29 @@ jobs: | |
echo "TAG_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV | ||
fi; | ||
# Populate docker-compose.yml with variables from build process, including TAG_NAME. | ||
- name: docker-compose file prep | ||
uses: danielr1996/[email protected] | ||
env: | ||
RELEASE_VERSION: ${{ env.TAG_NAME }} | ||
IMAGE_REPO: ${{ env.image_repository_name }} | ||
APP_NAME: ${{ github.event.repository.name }} | ||
HOST_DOMAIN: ${{ secrets.DEPLOY_API }} | ||
LETSENCRYPT_EMAIL: ${{ secrets.LETSENCRYPT_EMAIL }} | ||
DEPLOY_API: ${{ secrets.DEPLOY_API }} | ||
DEPLOY_CDN: ${{ secrets.DEPLOY_CDN }} | ||
with: | ||
input: .deploy/docker-compose-template.yml | ||
output: .deploy/${{ github.event.repository.name }}-docker-compose.yml | ||
- name: Create .env file | ||
run: | | ||
echo "Generating .env file" | ||
echo "#Autogenerated .env file" > .env | ||
echo "HOST_DOMAIN=${{ secrets.DEPLOY_API }}" >> .env | ||
echo "DEPLOY_API=${{ secrets.DEPLOY_API }}" >> .env | ||
echo "DEPLOY_CDN=${{ secrets.DEPLOY_CDN }}" >> .env | ||
echo "LETSENCRYPT_EMAIL=${{ secrets.LETSENCRYPT_EMAIL }}" >> .env | ||
echo "APP_NAME=${{ github.event.repository.name }}" >> .env | ||
echo "IMAGE_REPO=${{ env.image_repository_name }}" >> .env | ||
echo "RELEASE_VERSION=${{ env.TAG_NAME }}" >> .env | ||
# Copy only the docker-compose.yml to remote server home folder | ||
- name: copy compose file via scp | ||
- name: copy files to target server via scp | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.DEPLOY_API }} | ||
username: ${{ secrets.DEPLOY_USERNAME }} | ||
port: 22 | ||
key: ${{ secrets.DEPLOY_KEY }} | ||
source: ".deploy/${{ github.event.repository.name }}-docker-compose.yml" | ||
target: "~/" | ||
source: "./docker-compose.yml,./docker-compose.prod.yml,./.env" | ||
target: "~/.deploy/${{ github.event.repository.name }}/" | ||
|
||
- name: Run remote db migrations | ||
uses: appleboy/[email protected] | ||
|
@@ -171,10 +167,11 @@ jobs: | |
envs: APPTOKEN,USERNAME | ||
script: | | ||
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin | ||
docker compose -f ~/.deploy/${{ github.event.repository.name }}-docker-compose.yml pull | ||
docker compose -f ~/.deploy/${{ github.event.repository.name }}-docker-compose.yml up ${{ github.event.repository.name }}-migration --exit-code-from ${{ github.event.repository.name }}-migration | ||
cd ~/.deploy/${{ github.event.repository.name }} | ||
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull | ||
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app-migration | ||
# Deploy Docker image with ServiceStack application using `docker compose up` remotely | ||
# Deploy Docker image with your application using `docker compose up` remotely | ||
- name: remote docker-compose up via ssh | ||
uses: appleboy/[email protected] | ||
env: | ||
|
@@ -188,5 +185,6 @@ jobs: | |
envs: APPTOKEN,USERNAME | ||
script: | | ||
echo $APPTOKEN | docker login ghcr.io -u $USERNAME --password-stdin | ||
docker compose -f ~/.deploy/${{ github.event.repository.name }}-docker-compose.yml pull | ||
docker compose -f ~/.deploy/${{ github.event.repository.name }}-docker-compose.yml up -d | ||
cd ~/.deploy/${{ github.event.repository.name }} | ||
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml pull | ||
docker compose -f ./docker-compose.yml -f ./docker-compose.prod.yml up app -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.9" | ||
services: | ||
app: | ||
build: . | ||
ports: | ||
- "5000:80" | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
app-migration: | ||
build: . | ||
restart: "no" | ||
profiles: | ||
- migration | ||
command: --AppTasks=migrate | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
|
||
volumes: | ||
app-mydb: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3.9" | ||
services: | ||
app: | ||
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION} | ||
restart: always | ||
ports: | ||
- "80" | ||
container_name: ${APP_NAME}_app | ||
environment: | ||
VIRTUAL_HOST: ${HOST_DOMAIN} | ||
LETSENCRYPT_HOST: ${HOST_DOMAIN} | ||
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL} | ||
DEPLOY_API: ${DEPLOY_API} | ||
DEPLOY_CDN: ${DEPLOY_CDN} | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
app-migration: | ||
image: ghcr.io/${IMAGE_REPO}:${RELEASE_VERSION} | ||
restart: "no" | ||
container_name: ${APP_NAME}_app_migration | ||
profiles: | ||
- migration | ||
command: --AppTasks=migrate | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
|
||
networks: | ||
default: | ||
external: true | ||
name: nginx | ||
|
||
volumes: | ||
app-mydb: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.9" | ||
services: | ||
app: | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
app-migration: | ||
restart: "no" | ||
profiles: | ||
- migration | ||
command: --AppTasks=migrate | ||
volumes: | ||
- app-mydb:/app/App_Data | ||
|
||
volumes: | ||
app-mydb: |