Skip to content

Instantly share code, notes, and snippets.

@carlosdelfino
Last active November 25, 2019 17:35
Show Gist options
  • Save carlosdelfino/554601132005c8b66f04359519e731be to your computer and use it in GitHub Desktop.
Save carlosdelfino/554601132005c8b66f04359519e731be to your computer and use it in GitHub Desktop.
adjusts in docker files to use in quran.com project frontend v1
*.DS_Store
.vscode
.idea/
.awcache
.circleci
.github
.storybook
.git
build
dist
docs
coverage/
tests/
node_modules
/node_modules
static/dist
test-results.xml
npm-debug.log
npm-debug.log.*
webpack-stats.json
webpack-assets.json
bundle-stats.json
selenium-debug.log
webpack-stats.debug.json
FROM node:8.9
RUN apt-get -y update
RUN apt-get -y install apt-utils
RUN apt-get -y install supervisor ssh rsync
# logrotate
RUN apt-get -y install logrotate
COPY docker/supervisord.conf /etc/supervisor/supervisord.conf
COPY docker/pm2.logrotate.conf /etc/logrotate.d/pm2
RUN cp /etc/cron.daily/logrotate /etc/cron.hourly
# cache npm install when package.json hasn't changed
WORKDIR /tmp
ADD package-lock.json package.json ./
RUN npm install --silent --no-progress
RUN npm install -g pm2
RUN mkdir /quran
RUN cp -a package-lock.json package.json /tmp/node_modules /quran
WORKDIR /quran
ADD tsconfig.json tsconfig.json
ADD src ./src
ADD config ./config
ADD internal ./internal
ADD static ./static
ADD shared ./shared
RUN ls -lha
#### build client and server
ENV SENTRY_KEY_CLIENT https://app.getsentry.com
ENV SENTRY_KEY_SERVER https://app.getsentry.com
ENV PORT 8000
ENV SEGMENTS_KEY=
# Quran.com - development app, no need to worry!
ENV API_URL http://api.quran.com:3000
#ENV API_URL=https://staging.quran.com:3000
ENV ONE_QURAN_URL https://one.quran.com
#ENV ONE_QURAN_URL=http://localhost:3030
ENV FACEBOOK_APP_ID=1599019233731707
#ENV FACEBOOK_APP_ID appid
ENV FONTS_URL=//quran-1f14.kxcdn.com
ENV AUDIO_CDN=//audio.qurancdn.com
ENV NODE_ENV production
ENV NODE_PATH "./dist"
RUN npm run build:client
RUN npm run build:server
# ssh keys
WORKDIR /root
ADD .ssh /root/
#RUN mv /quran/.ssh /root/
# upload js and css
WORKDIR /quran/static/dist
RUN rsync --update --progress -raz . ahmedre@rsync.keycdn.com:zones/assets/
# go back to /quran
WORKDIR /quran
EXPOSE 8000
CMD ["supervisord", "--nodaemon", "-c", "/etc/supervisor/supervisord.conf"]
@carlosdelfino
Copy link
Author

Portuguese:

Eu criei um gist com as configurações que estou preprando para meu ambiente, como meu objetivo é bem peculiar, ou seja é preparar meu fork para que eu esteja hápito a trabalhar no Windows 10, com suas mazelas, contribuindo então com o projeto original e oficial, não sei se neste momento é interessante que eu faça um PR diretamente, pois minhas configurações podem ser muito particulares (individuais).

Eu não usaria o Docker como está sendo usado hoje, acabei de chegar, queria me inteirar sobre os 'W'. Além disso não domino tanto assim o Docker para poder propor com precisão a forma que eu considero mais adequada, já que ela são baseadas em trabalho de terceiros, eu mesmo tenho pouca experiência.

A forma que penso ser melhor é montar a pasta de trabalho dentro do container ao invés de copia-la. Assim o repositório seria desmembrado em dois o que possui o projeto quran.com-frontend em si, e o repositório com os parâmetros de construção do container, este teria como submódulo (git submodule) o projeto original em uma pasta que então seria montada no docker para compilação e execução, já que o Dockerdaemon não agrada muito de copiar grandes quantidades de arquivos via contexto.

(me desculpem pelo meu inglês, leio relativamente bem, mas não sou nativo para escrita, então uso o tradutor para me auxiliar)

@carlosdelfino
Copy link
Author

English:

Portuguese:

I created a gist with the settings that I am preparing for my environment, as my goal is very peculiar, that is to prepare my fork so that I am able to work on Windows 10, with its ills, contributing to the original and official project. , I do not know if at this point it is interesting that I do a PR directly, because my settings can be very particular (individual).

I would not use Docker as it is being used today, I just arrived, I wanted to find out about the 'W'. Also, I do not master Docker that much so that I can accurately propose the form I consider most appropriate, since they are based on third party work, I myself have little experience.

The way I think is better is to mount the workbook inside the container instead of copying it. So the repository would be split into two which has the quran.com-frontend project itself, and the repository with the container build parameters would have the original project as a git submodule in a folder that would then be mounted in docker for compilation and execution, as Dockerdaemon doesn't like copying large amounts of files via context.

(Sorry for my English, I read relatively well, but I'm not native to writing, so I use the translator to help me)

@carlosdelfino
Copy link
Author

carlosdelfino commented Nov 25, 2019

Portuguese:

Adicionado as variáveis de ambiente contidas no arquivo .env e ajustado com as pré existentes no antigo dockerfile.

O arquivo .env não é preciso no Docker já que se pode criar tais variáveis através do próprio Dockerfile, portanto ele é ignorado através do arquivo .dockerignore.

@carlosdelfino
Copy link
Author

English:

Added environment variables contained in the .env file and adjusted with pre-existing ones in the old dockerfile.

The .env file is not needed in Docker since you can create such variables through Dockerfile itself, so it is ignored through the .dockerignore file..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment