Compare commits

..

6 Commits

Author SHA1 Message Date
Isaac Abadi
ab5cd409bb Attempt to reduce docker image size 2022-05-05 03:04:30 -04:00
Isaac Abadi
e0509e8091 Merge branch 'master' of https://github.com/Tzahi12345/YoutubeDL-Material into docker-ubuntu 2022-05-05 03:03:44 -04:00
Isaac Abadi
0c1568b38d Renamed postbuild.mjs to postbuild.js 2022-04-30 23:30:56 -04:00
Isaac Abadi
f8a0d14968 Updated Dockerfile to support ubuntu 2022-04-30 17:17:07 -04:00
Isaac Abadi
f5894e6bc0 apk add -> apt-get 2022-04-30 13:50:41 -04:00
Isaac Abadi
f205f8e58e Switched from alpine to ubuntu 2022-04-30 13:38:26 -04:00
4 changed files with 60 additions and 14 deletions

View File

@@ -1,22 +1,24 @@
FROM ubuntu:20.04 AS ffmpeg
FROM ubuntu:22.04 AS ffmpeg
ENV DEBIAN_FRONTEND=noninteractive
COPY docker-build.sh .
RUN sh ./docker-build.sh
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:savoury1/ffmpeg4
RUN add-apt-repository ppa:savoury1/ffmpeg5 && apt-get update && apt-get install -y ffmpeg
#--------------# Stage 2
FROM ubuntu:20.04 as frontend
FROM ubuntu:22.04 as frontend
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y install \
curl && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y gnupg \
curl \
gnupg \
# Ubuntu 22.04 ships Node.JS 12 by default :)
nodejs \
yarn && \
# needed on 21.10 and before, maybe not on 22.04 YARN: brings along npm, solves dependency conflicts,
# spares us this spaghetti approach: https://stackoverflow.com/a/60547197
npm && \
apt-get install -f && \
npm config set strict-ssl false && \
npm install -g @angular/cli
@@ -31,7 +33,7 @@ RUN npm run build
#--------------# Final Stage
FROM ubuntu:20.04
FROM ubuntu:22.04
ENV UID=1000 \
GID=1000 \
@@ -47,7 +49,8 @@ RUN apt-get update && apt-get -y install \
python2 \
python3 \
gosu \
atomicparsley && \
atomicparsley \
--no-install-recommends && \
apt-get install -f && \
apt-get autoremove --purge && \
apt-get autoremove && \
@@ -70,5 +73,5 @@ COPY --chown=$UID:$GID --from=frontend [ "/build/backend/public/", "/app/public/
COPY --chown=$UID:$GID [ "/backend/", "/app/" ]
EXPOSE 17442
ENTRYPOINT [ "/app/entrypoint.sh" ]
# ENTRYPOINT [ "/app/entrypoint.sh" ]
CMD [ "pm2-runtime", "pm2.config.js" ]

View File

@@ -90,7 +90,7 @@ exports.updateYoutubeDL = async (latest_update_version) => {
exports.verifyBinaryExistsLinux = () => {
const details_json = fs.readJSONSync(CONSTS.DETAILS_BIN_PATH);
if (!is_windows && details_json && details_json['path'] && details_json['path'].includes('.exe')) {
if (!is_windows && details_json && details_json['path'].includes('.exe')) {
details_json['path'] = 'node_modules/youtube-dl/bin/youtube-dl';
details_json['exec'] = 'youtube-dl';
details_json['version'] = OUTDATED_VERSION;

View File

@@ -6,7 +6,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build --configuration production",
"prebuild": "node src/postbuild.mjs",
"prebuild": "node src/postbuild.js",
"heroku-postbuild": "npm install --prefix backend",
"test": "ng test",
"lint": "ng lint",

43
src/postbuild.js Normal file
View File

@@ -0,0 +1,43 @@
const fs = require('fs-extra');
const path = require('path');
const xliffToJSON = require('xliff-to-json');
async function recFindByExt(base,ext,files,result)
{
files = files || (await fs.readdir(base))
result = result || []
for (const file of files) {
var newbase = path.join(base,file)
if ( (await fs.stat(newbase)).isDirectory() )
{
result = await recFindByExt(newbase,ext,await fs.readdir(newbase),result)
}
else
{
if ( file.substr(-1*(ext.length+1)) == '.' + ext )
{
result.push(newbase)
}
}
}
return result
}
// outputs array of supported locales
async function createLocalizationJSON() {
xliffToJSON.convert('src/assets/i18n');
const files = await recFindByExt(path.join('src', 'assets', 'i18n'), 'json');
const locales = [];
for (let i = 0; i < files.length; i++) {
const file = path.basename(files[i]);
const file_parts = file.split('.');
locales.push(file_parts[1]);
}
fs.unlinkSync('src/assets/i18n/messages.en.json');
fs.writeJSONSync('src/assets/i18n/supported_locales.json', {supported_locales: locales});
}
createLocalizationJSON();