-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some voulmizer to the folicles (#60)
* Add some voulmizer to the folicles * Specify node_env for all the ci jobs * Expose node_env in the server
- Loading branch information
Showing
16 changed files
with
1,388 additions
and
28 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
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
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
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,7 @@ | ||
dist | ||
node_modules | ||
dist/** | ||
node_modules/** | ||
|
||
|
||
.npm | ||
.bash_history | ||
.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 |
---|---|---|
@@ -1,26 +1,50 @@ | ||
ARG HOME=/app UID=9500 GID=9500 VERSION="base" | ||
ARG NODE_ENV=production | ||
|
||
# Define the base image, here we are root. | ||
FROM node:18 as base | ||
|
||
WORKDIR /app | ||
RUN touch /is-docker | ||
|
||
# Define the user and working directory, everything from this is user land | ||
FROM base as user | ||
|
||
ARG HOME UID GID | ||
|
||
RUN <<EOF | ||
groupadd -g ${GID} user | ||
useradd -u ${UID} -g ${GID} -s /sbin/nologin -d ${HOME} user | ||
EOF | ||
|
||
USER user | ||
WORKDIR ${HOME} | ||
|
||
FROM user as build | ||
|
||
RUN --mount=type=bind,src=package.json,dst=/app/package.json \ | ||
npm install | ||
ARG HOME | ||
# Always development for building as we need to build the code | ||
ENV NODE_ENV=development | ||
|
||
RUN \ | ||
--mount=type=bind,src=package.json,dst=/app/package.json \ | ||
--mount=type=bind,src=src,dst=/app/src/ \ | ||
--mount=type=bind,src=tsconfig.json,dst=/app/tsconfig.json \ | ||
npm run build | ||
--mount=type=bind,source=src,target=${HOME}/src \ | ||
--mount=type=bind,source=package.json,target=${HOME}/package.json \ | ||
--mount=type=bind,source=package-lock.json,target=${HOME}/package-lock.json \ | ||
--mount=type=bind,source=tsconfig.json,target=${HOME}/tsconfig.json \ | ||
<<EOF | ||
npm install --loglevel=verbose --no-save | ||
npm run build | ||
EOF | ||
|
||
FROM base as final | ||
FROM user as final | ||
|
||
ARG VERSION="base" | ||
ARG HOME VERSION NODE_ENV | ||
|
||
ENV VERSION=${VERSION} | ||
ENV VERSION=${VERSION} NODE_ENV=${NODE_ENV} | ||
|
||
COPY --from=base /app/dist /app/dist | ||
COPY package.json /app/package.json | ||
COPY --from=build ${HOME}/dist ${HOME}/dist | ||
COPY package.json package-lock.json ${HOME}/ | ||
|
||
RUN npm i --omit=dev --no-save | ||
RUN npm install --loglevel=verbose --no-save | ||
|
||
EXPOSE 3000 | ||
|
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,39 @@ | ||
.PHONY: default | ||
default: help | ||
|
||
.PHONY: up | ||
up: ## Build and start containers | ||
mkdir -p node_modules | ||
mkdir -p dist | ||
docker compose up -d --build | ||
|
||
.PHONY: build | ||
build: ## Build the app container | ||
docker compose build --no-cache --progress=plain | ||
|
||
.PHONY: down | ||
down: ## Stop and remove containers, networks, images, and volumes | ||
docker compose down $(ARGS) | ||
|
||
.PHONY: clean | ||
clean: ## Remove all containers, networks, images, and volumes | ||
make down ARGS="--rmi all --volumes" | ||
docker builder prune -af | ||
|
||
.PHONY: shell | ||
shell: ## Access to the shell of the app docker container | ||
docker compose exec app /bin/bash | ||
|
||
.PHONY: install | ||
install: ## Install dependencies | ||
docker compose exec app npm install $(ARGS) --loglevel=verbose | ||
|
||
.PHONY: test | ||
test: ## Run tests | ||
docker compose exec app npm test $(ARGS) | ||
|
||
.PHONY: help | ||
help: | ||
@echo "Please use 'make <target>' where <target> is one of the following commands.\n" | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
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,26 @@ | ||
version: '3.8' | ||
services: | ||
app: | ||
build: | ||
context: . | ||
args: | ||
NODE_ENV: development | ||
volumes: | ||
- node_modules:/app/node_modules | ||
- dist:/app/dist | ||
- .:/app:delegated | ||
command: npm run dev | ||
ports: | ||
- 3000:3000 | ||
|
||
volumes: | ||
node_modules: | ||
driver_opts: | ||
type: "none" | ||
o: "bind" | ||
device: "${PWD}/node_modules" | ||
dist: | ||
driver_opts: | ||
type: "none" | ||
o: "bind" | ||
device: "${PWD}/dist" |
Oops, something went wrong.