-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d73f05
commit 2db23e3
Showing
13 changed files
with
36 additions
and
52 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,3 +1,10 @@ | ||
NODE_RELEASE=22 | ||
NGINX_RELEASE=1.27-alpine-slim | ||
FRONTEND_COMPOSE_NAME=frontend-compose | ||
API_PORT=3000 | ||
API_HOST=api-host-or-docker-container-name | ||
DEPLOY_BRANCH=master | ||
|
||
VITE_DEPLOY_HOSTNAME=my-domain.com | ||
VITE_HTTPS=true | ||
VITE_DEV_API_PROXY_URL=http://localhost:9000 |
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 |
---|---|---|
|
@@ -95,6 +95,7 @@ docs | |
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
container-dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
|
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ lerna-debug.log* | |
|
||
node_modules | ||
dist | ||
container-dist | ||
dist-ssr | ||
*.local | ||
|
||
|
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ lerna-debug.log* | |
|
||
node_modules | ||
dist | ||
container-dist | ||
dist-ssr | ||
*.local | ||
|
||
|
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,48 +1,28 @@ | ||
ARG NGINX_RELEASE | ||
ARG NODE_RELEASE | ||
|
||
FROM node:${NODE_RELEASE:-18} as build | ||
FROM node:${NODE_RELEASE:-22} as build | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
USER root | ||
|
||
# copy project to workdir | ||
COPY .. /home/node/front | ||
WORKDIR /home/node/front | ||
|
||
# install envsubst | ||
RUN apt-get update -y && apt-get install --no-install-recommends -y \ | ||
gettext-base | ||
#install anything you want | ||
#RUN apt-get update -y && apt-get install --no-install-recommends -y \ | ||
# anything-you-want | ||
|
||
# build project - create static dist files | ||
RUN yarn | ||
RUN yarn dist | ||
|
||
# substitute env variables into nginx.conf | ||
# you can add any your variables that you need to substitute into nginx.conf | ||
ARG DOMAIN_URL | ||
ARG API_HOST | ||
ARG API_PORT | ||
RUN export DOMAIN_URL=${DOMAIN_URL} && \ | ||
export API_HOST=${API_HOST} && \ | ||
export API_PORT=${API_PORT} && \ | ||
export DOLLAR="$" && \ | ||
envsubst < /home/node/front/docker-deploy/nginx/nginx.conf > /home/node/front/docker-deploy/nginx/_nginx-substituted.conf && \ | ||
cd /home/node/front/docker-deploy/nginx/locations/http && \ | ||
mkdir /home/node/front/docker-deploy/nginx/locations/_http-substituted && \ | ||
for file in *; do envsubst < $file > ../_http-substituted/$file; done && \ | ||
cd /home/node/front/docker-deploy/nginx/locations/https && \ | ||
mkdir /home/node/front/docker-deploy/nginx/locations/_https-substituted && \ | ||
for file in *; do envsubst < $file > ../_https-substituted/$file; done | ||
|
||
RUN yarn build | ||
|
||
# Finally - get only needed files from previous build stage. Static files + config | ||
FROM nginx:${NGINX_RELEASE:-1.27-alpine-slim} | ||
|
||
#install nginx modules | ||
#RUN apt-get update -y && apt-get install --no-install-recommends -y \ | ||
# nginx-plus-module-brotli | ||
# nginx-plus-module-brotli | ||
|
||
COPY --from=build /home/node/front/dist /frontend-dist | ||
COPY --from=build /home/node/front/docker-deploy/nginx/_nginx-substituted.conf /etc/nginx/nginx.conf | ||
COPY --from=build /home/node/front/docker-deploy/nginx/locations/_http-substituted /etc/nginx/include_locations/http | ||
COPY --from=build /home/node/front/docker-deploy/nginx/locations/_https-substituted /etc/nginx/include_locations/https | ||
COPY --from=build /home/node/front/docker-deploy/nginx/templates /etc/nginx/templates |
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
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
File renamed without changes.
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
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
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 @@ | ||
git fetch --all | ||
git reset --hard "origin/$(. "docker-deploy/.env"; echo "$DEPLOY_BRANCH")" | ||
git reset --hard "origin/$(. ".env"; echo "$DEPLOY_BRANCH")" | ||
echo "Deploying last commit:" | ||
git log --oneline -1 | ||
cd docker-deploy || exit | ||
docker compose down | ||
docker compose up -d nginx --build | ||
docker compose --env-file ../.env down | ||
docker compose --env-file ../.env up -d nginx --build | ||
echo "Frontend updated successfully" |
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