@@ -2,65 +2,27 @@ FROM node:14 AS development
22
33ENV USERNAME timetracker
44ENV HOME /home/${USERNAME}
5- ENV CHROME_BIN /opt/google/chrome/google-chrome
6- # Essential tools and xvfb
7- RUN apt-get update && apt-get install -y \
8- software-properties-common \
9- unzip \
10- curl \
11- wget \
12- xvfb
13-
14- # Chrome browser to run the tests
15- ARG CHROME_VERSION=65.0.3325.181
16- RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add \
17- && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
18- && dpkg -i google-chrome-stable_current_amd64.deb || true
19- RUN apt-get install -y -f \
20- && rm -rf /var/lib/apt/lists/*
21-
22- # Disable the SUID sandbox so that chrome can launch without being in a privileged container
23- RUN dpkg-divert --add --rename --divert /opt/google/chrome/google-chrome.real /opt/google/chrome/google-chrome \
24- && echo "#! /bin/bash\n exec /opt/google/chrome/google-chrome.real --no-sandbox --disable-setuid-sandbox \"\$ @\" " > /opt/google/chrome/google-chrome \
25- && chmod 755 /opt/google/chrome/google-chrome
26-
27- # Chrome Driver
28- ARG CHROME_DRIVER_VERSION=2.37
29- RUN mkdir -p /opt/selenium \
30- && curl http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -o /opt/selenium/chromedriver_linux64.zip \
31- && cd /opt/selenium; unzip /opt/selenium/chromedriver_linux64.zip; rm -rf chromedriver_linux64.zip; ln -fs /opt/selenium/chromedriver /usr/local/bin/chromedriver;
32-
335RUN useradd -ms /bin/bash ${USERNAME}
34-
356WORKDIR ${HOME}/time-tracker-ui
367COPY . .
37- RUN rm -f .env
388RUN chown ${USERNAME}:${USERNAME} -R ${HOME}/time-tracker-ui
399RUN chmod -R 777 ${HOME}/time-tracker-ui
4010
41-
4211USER ${USERNAME}
4312RUN npm cache clean --force && npm install
44- EXPOSE 4200
45- EXPOSE 9876
46- CMD npm run config && ${HOME}/time-tracker-ui/node_modules/.bin/ng serve --host 0.0.0.0 --disableHostCheck
47-
48-
4913
5014FROM development as build
5115COPY .env .
5216RUN npm run config && npm run build
5317
54-
55-
5618FROM nginx:1.21 AS production
5719
5820ENV USERNAME app
5921RUN useradd -ms /bin/bash ${USERNAME}
6022
6123COPY nginx.conf /etc/nginx/conf.d/default.conf
6224COPY --from=build /home/timetracker/time-tracker-ui/dist/time-tracker /usr/share/nginx/html
63-
25+ COPY .env /usr/share/nginx/html
6426RUN chown -R ${USERNAME}:${USERNAME} /var/cache/nginx && \
6527 chown -R ${USERNAME}:${USERNAME} /var/log/nginx && \
6628 chown -R ${USERNAME}:${USERNAME} /etc/nginx/conf.d
@@ -74,4 +36,4 @@ RUN touch /var/run/nginx.pid && chown -R ${USERNAME}:${USERNAME} /var/run/nginx.
7436
7537# USER ${USERNAME}
7638
77- EXPOSE 80
39+ EXPOSE 80
0 commit comments