Skip to content

Commit

Permalink
chore/workflow-update/draft/0 (#2298)
Browse files Browse the repository at this point in the history
* build(docker): update dockerfile

[1] ────
Update Dockerfile for dynamic secret injection at runtime.
[2] ────
Add new 'env/.env.docker.file' for environment variables to be used for on docker image creation (safe for version control).
[3] ────
Add new '.scripts/*' for new docker image (1) entrypoint and (2) enviornment variable replacing at run-time.

* build(docker): update

[1] ────
Update 'docker-compose.yml' to accomodate for run-time environments injection.
[2] ────
Update '.dockerignore' to latest project structure.

* chore(env): replace & new

[1] ────
Displace the '.env.example' in './' to 'env/*' directory named '.env.placeholder.docker.scores'.

* chore(git): update

[1] ────
Update '.gitignore' to latest structure.

* chore(vite): update

[1] ────
Update 'vite.config.ts' for code clean up, better commenting and 'build-time' logs.

* ci(github): rename actions

[1] ────
Rename '.github/workflow/*' files and some redundant code clean up.

* chore(make): update

[1] ────
Update 'Makefile' for new target 'docker-image-build' that builds the betarena scores image.

* build(docker): update scripts

[1] ────
Update '.scripts/docker.env.inject.sh' for secret injection adjustment and respective clean up of intermediate evnrionment variables.

* ci(github): update test actions

[1] ────
Update 'pr.main.tag.yml' for 'github actions' to make use of a new 'docker image build & publish' job.
[2] ────
Update 'Makefile' for 'github actions' new target named 'docker-image-publish-to-registry'.

* build(package,docker): update

[1] ────
Update 'package.json' for updated 'scripts' definitions with standard Betarena code format.
[2] ────
Add snapshot for 'pnpm' with the 'pnpm-lock.yaml' file.
[3] ────
Update 'Dockerfile' and '.scripts' for the respective changes in 'package.json > scripts' declarations name change.

* ci(github): update actions

[1] ────
Update '.github/workflow/*' for changes in code format to match Betarena standard.

* chore(makefile): remove targets

[1] ────
Update Makefile to remove target for 'dev-local-1-click' which is deemed redundant.

* ci(github): update actions

[1] ────
Update '.github/workflow/*' for update in check branch.
  • Loading branch information
migbash authored Dec 11, 2024
1 parent d02d927 commit 77bc92a
Show file tree
Hide file tree
Showing 16 changed files with 16,892 additions and 480 deletions.
45 changes: 39 additions & 6 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,64 @@ RUN \
npm install -g npm@10.2.3 && \
npm install --omit=optional --production --ignore-scripts
#
# [🐞]
RUN ls -lha

FROM base AS build
COPY . /app
COPY ./env/.env.docker.file /app/.env
WORKDIR /app
RUN apk add --no-cache python3 make g++
RUN npm install -g npm@10.2.3 && npm i --omit=optional
RUN npm run build
RUN npm run "sveltekit|:|build"
RUN npm run "server|:|build"
RUN \
npm install -g npm@10.2.3 && \
npm i --omit=optional
#
# [🐞]
RUN ls -lha
RUN npm run "build"
RUN npm run "tsc/build/server"

# ╭──────────────────────────────────────────────────────────────────────────────────╮
# │ 🏗️ STEP 2 │ Final Docker Build │
# ╰──────────────────────────────────────────────────────────────────────────────────╯

FROM base AS final
WORKDIR /app
USER node:node
COPY --from=prod-deps /app/node_modules node_modules/
COPY --from=build /app/build build/
COPY --from=build /app/dist/dual.instance.js dual.instance.js
COPY --from=build /app/package.json /app/.env ./
COPY --from=build /app/.scripts .scripts/
# [🐞]
RUN ls -lha

RUN chmod +x .scripts/*.sh

# ╭──────────────────────────────────────────────────────────────────────────────────╮
# │ 🏗️ STEP 3 │ Code Deployment │
# ╰──────────────────────────────────────────────────────────────────────────────────╯

LABEL \
authors="20924663+migbash@users.noreply.github.com" \
version="1.0.0" \
description="Betarena - Scores - Docker Image" \
organization="Betarena" \
project="Scores" \
type="frontend"
#
# HEALTHCHECK \
# --interval=30s \
# --timeout=5s \
# --retries=3 \
# # --start-interval=5s \
# --start-period=5s \
# CMD [ "/app/.scripts/docker.healthcheck.sh" ]
#
# RUN apk --no-cache add curl

EXPOSE 5055
CMD ["npm", "run", "sveltekit|:|start|:|docker"]
ENTRYPOINT [ "/app/.scripts/docker.entrypoint.sh" ]
# ╭─────
# │ NOTE: |:| Alternative [1]
# ╰─────
# CMD ["npm", "run", "sveltekit|:|start|:|docker"]
35 changes: 29 additions & 6 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# ╭──────────────────────────────────────────────────────────────────────────────────╮
# │ 📌 High Order Overview │
# ┣──────────────────────────────────────────────────────────────────────────────────┫
# │ ➤ Code Format // V.8.0 │
# │ ➤ Status // 🔒 LOCKED │
# │ ➤ Author(s) // @migbash │
# │ ➤ Maintainer(s) // @migbash │
# │ ➤ Created on // <date-created> │
# ┣──────────────────────────────────────────────────────────────────────────────────┫
# │ 📝 Description │
# ┣──────────────────────────────────────────────────────────────────────────────────┫
# │ BETARENA (Module)
# │ |: Docker Compose Configuration
# ╰──────────────────────────────────────────────────────────────────────────────────╯

name: betarena-scores

services:
Expand Down Expand Up @@ -60,25 +75,32 @@ services:
# │ 🟦 │ APPLICATION CONTAINER(s) │
# ╰──────────────────────────────────────────────────────────────────────────────────╯

web-prod:
image: betarena-scores:1.0.0
scores:
image: name4d/betarena:scores-latest
# ╭─────
# │ WARNING:
# │ |: Does not work with 'deploy.replicas: [n]' configuration
# ╰─────
# container_name: web-prod
# container_name: scores
restart: always
# ╭─────
# │ NOTE:
# │ |: Use the following build configuration for local development
# ╰─────
# │ |: For for DEVELOPMENT (LOCAL) [commented out]
# ╰─ ⤦⤦⤦⤦
# build:
# context: ../
# dockerfile: ./.docker/Dockerfile
deploy:
replicas: 3
replicas: ${BETARNA_SCORES__REPLICAS:-1}
env_file: ../env/.env.docker.scores
expose:
- 3000
# ╭─────
# │ NOTE:
# │ |: For for DEVELOPMENT (LOCAL) [commented out]
# ╰─ ⤦⤦⤦⤦
# ports:
# - 3000:3000
logging:
driver: local
options:
Expand All @@ -91,3 +113,4 @@ services:
networks:
loadbalancer:
driver: bridge
#
40 changes: 19 additions & 21 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
# ╭──────────────────────────────────────────────────────────────────╮
#🚀 │ NODE // NPM
# ╰──────────────────────────────────────────────────────────────────╯
# ╭──────────────────────────────────────────────────────────────────────────────────
#🟩 │ NODE NPM
# ╰──────────────────────────────────────────────────────────────────────────────────

node_modules/
npm-debug.log
.npmrc
.nvmrc

# ╭──────────────────────────────────────────────────────────────────╮
#🚀 │ LOCAL // DEVELOPMENT
# ╰──────────────────────────────────────────────────────────────────╯
# ╭──────────────────────────────────────────────────────────────────────────────────
#🏗️ │ LOCAL DEVELOPMENT │ BUILD-OUTPUT
# ╰──────────────────────────────────────────────────────────────────────────────────

.svelte-kit/
build/
debug/
dist/
cert/
.nginx/
debug/

# ╭──────────────────────────────────────────────────────────────────╮
# │ 💠 │ MISCELLENOUS
# ╰──────────────────────────────────────────────────────────────────╯
# ╭──────────────────────────────────────────────────────────────────────────────────
# │ 💠 │ MISCELLENOUS
# ╰──────────────────────────────────────────────────────────────────────────────────

.github/
.devcontainer/
Expand All @@ -29,19 +30,16 @@ cert/
.eslintrc.yaml
.gitignore
.deepsource.toml
.sentryclirc
Procfile
README.md
CHANGELOG.md
Procfile
.deepsource.toml

# ╭──────────────────────────────────────────────────────────────────╮
# │ 🔑 │ SECRETS │
# ╰──────────────────────────────────────────────────────────────────╯
# ╭──────────────────────────────────────────────────────────────────────────────────
# │ 🔑 │ SECRETS
# ╰──────────────────────────────────────────────────────────────────────────────────

env/placeholder/
.env*
!.env
.flaskenv*
!.env.project
!.env.vault
.sentryclirc
!.env.vault
!.env.docker.file
134 changes: 0 additions & 134 deletions .env.example

This file was deleted.

Loading

0 comments on commit 77bc92a

Please sign in to comment.