Open kenadet opened 7 years ago
I'm not sure if you still need help but in case you do:
If you use the normal Angular build process (ng build --prod
) you don't need TypeScript anymore. Angular uses webpack to pack everything into a few handy JavaScript files (including all of the dependencies).
I'm not really sure what you try to archive here. This is a pure front-end framework so you don't need ts-node (a typescript-node.js server) at any point. You need to call the angular build process and move it's output into your server's "public"-path.
I hope this helps a little bit.
Thanks bb1, I was a able to solve the problem by using this Dockerfile:
# Create a new image from the base nodejs 7 image.
FROM node:7
# Create the target directory in the imahge
RUN mkdir -p /usr/src/app
# Set the created directory as the working directory
WORKDIR /usr/src/app
# Copy the package.json inside the working directory
COPY package.json package-lock.json /usr/src/app/
# Install required dependencies
RUN npm install
# Copy the client application source files. You can use .dockerignore to exlcude files. Works just as .gitignore does.
COPY . /usr/src/app
# Open port 4201. This is the port that our development server uses
EXPOSE 4201
# Start the application. This is the same as running ng serve.
CMD ["npm", "start"]
I have not tried yours, perhaps you could provide the tested Dockerfile as well. Thanks.
I am trying to dockerize this app, but unable to do it due to the following errors:
FROM node:8.2.1
RUN mkdir -p /usr/src/app
COPY package.json /usr/src/app/ COPY gulpfile.ts /usr/src/app/ COPY protractor.conf.js /usr/src/app/ COPY test-config.js /usr/src/app/ COPY test-main.js /usr/src/app/ COPY tsconfig.json /usr/src/app/ COPY tslint.json /usr/src/app/ COPY karma.conf.js /usr/src/app/ COPY appveyor.yml /usr/src/app/ COPY tools/* /usr/src/app/
WORKDIR /usr/src/app/
RUN npm install -g bower \ && npm i -g gulp-cli \ && npm i typings@1.3.3 --save-dev \ && npm i typescript-node --save-dev\ && npm i typescript-register --save-dev\ && npm i typescript-require --save-dev \ && npm i typescript@2.0.2 --save=dev \ && npm install ts-node@1.3.0 --save-dev \ && npm install gulp --save-dev \ && npm install --production \ && ln -s /usr/local/bin/gulp /usr/bin/gulp \ && apt-get -qqy clean && rm -rf /var/cache/apt/*
COPY dist/* /usr/src/app/
EXPOSE 5555
CMD ["npm", "start"]