-
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.
- Loading branch information
1 parent
ca2b7f0
commit fb17c5c
Showing
11 changed files
with
5,060 additions
and
3,734 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 @@ | ||
node_modules | ||
.git |
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,74 @@ | ||
####################### | ||
# Step 1: Base target # | ||
####################### | ||
FROM node:20 as development | ||
|
||
ARG NPM_VERBOSE | ||
ARG port | ||
ARG app_path | ||
|
||
# Base dir /app | ||
WORKDIR /$app_path | ||
|
||
COPY package.json ./ | ||
|
||
RUN if [ -z "${NPM_VERBOSE}" ]; then\ | ||
npm install; \ | ||
else \ | ||
npm install --verbose; \ | ||
fi | ||
|
||
VOLUME /${app_path}/src | ||
VOLUME /${app_path}/dist | ||
VOLUME /${app_path}/tests | ||
VOLUME /${app_path}/data | ||
|
||
COPY tsconfig.json ./ | ||
|
||
# Expose the listening port of your app | ||
EXPOSE ${port} | ||
|
||
CMD ["npm","run", "dev"] | ||
|
||
########################## | ||
# Step 3: "build" target # | ||
########################## | ||
FROM development as build | ||
ARG app_path | ||
|
||
WORKDIR /$app_path | ||
|
||
ADD src ./src | ||
|
||
COPY tsconfig.json ./ | ||
|
||
RUN npm run build && tar czvf dist.tar.gz dist | ||
|
||
############################### | ||
# Step 4: "production" target # | ||
############################### | ||
FROM node:20-alpine3.18 as production | ||
ARG port | ||
ARG app_path | ||
|
||
WORKDIR /$app_path | ||
|
||
COPY package.json ./ | ||
ADD tests ./tests | ||
ADD data ./data | ||
|
||
## Install production dependencies and clean cache | ||
#RUN npm install --production && \ | ||
# npm cache clean --force | ||
|
||
COPY --from=build /${app_path}/node_modules /${app_path}/node_modules | ||
COPY --from=build /${app_path}/dist.tar.gz /${app_path}/ | ||
|
||
RUN apk --no-cache add curl tar && \ | ||
tar -zxvf dist.tar.gz && \ | ||
rm -rf dist.tar.gz && apk del tar | ||
|
||
# Expose the listening port of your app | ||
EXPOSE ${port} | ||
|
||
CMD ["npm","run", "start"] |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
services: | ||
backend: | ||
image: ${APP} | ||
container_name: ${APP} | ||
build: | ||
context: . | ||
target: ${EXEC_ENV} | ||
args: | ||
app_path: /${APP} | ||
NPM_VERBOSE: ${NPM_VERBOSE} | ||
environment: | ||
- port=${PORT} | ||
- app_path=${APP} | ||
- PODCAST_DIR=${PODCAST_DIR} | ||
- DEVICE=${DEVICE} | ||
- PORT_MQTT=${PORT_MQTT} | ||
- HOST_MQTT=${HOST_MQTT} | ||
- HOST_MOPIDY=${HOST_MOPIDY} | ||
- HOST_RHASSPY=${HOST_RHASSPY} | ||
- HOST_SNAPCAST=${HOST_SNAPCAST} | ||
volumes: | ||
- ${APP_PATH}/src:/${APP}/src |
Oops, something went wrong.