Code Monkey home page Code Monkey logo

angular4-docker-example's Introduction

Dockerized Angular 4 App (with Angular CLI)

License: MIT

Build docker image

$ docker build -t myapp . 

Run the container

$ docker run -d -p 8080:80 myapp

The app will be available at http://localhost:8080

You can easily tweak the nginx config in nginx/default.conf

angular4-docker-example's People

Contributors

angular-cli avatar avatsaev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular4-docker-example's Issues

Proxy-Problems

Hello there.
I've got a problem building the image. npm seems to reach some IPs but isnt able to connect.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/aproba):
npm WARN network SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz failed, reason: connect ETIMEDOUT 151.101.112.162:443

I am behind a proxy. How can I change your Dockerfile to setup the proxy for npm?
Would it be enough to just use this command?
npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>

I would insert it directly before or after RUN npm set progress=false && npm config set depth 0 && npm cache clean --force

Do you have a solution? :/

Thank you in advance :)

Build Error

Hi Just tried to build your example

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/app/src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts
The command '/bin/sh -c npm install && ng build --aot --prod && rm -rf /usr/share/nginx/html/* && mv ./dist/* /usr/share/nginx/html/ && npm cache clean && apk del nodejs libstdc++ libgcc libuv http-parser ca-certificates && rm -rf ./*' returned a non-zero code: 1

OS. Ubuntu 16.04 (Virtual Box)
Docker version 17.06.0-ce, build 02c1d87

while this is not a issue

Hi i like to know what are the benefits you observed by using docker to run your project?

thanks in advance.

getting 403 Forbidden error

I have followed all the steps and I am getting the 403 Forbidden error.
I am using MacBook pro.

docker run -it -p 8080:80 docker-angular-ex

Screenshot 2019-04-08 at 2 38 42 PM

Error on ng build step

@avatsaev, I'm trying to run your example and it gets an error in the 7th step (ng build).

My Docker info:

Containers: 9
 Running: 1
 Paused: 0
 Stopped: 8
Images: 48
Server Version: 18.04.0-ce
Storage Driver: overlay2
 Backing Filesystem: xfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 773c489c9c1b21a6d78b5c538cd395416ec50f88
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-693.21.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 7.703GiB
Name: mytest.local
ID: UA4Z:XGN3:PHH6:6RNZ:PVLJ:FFCP:SPGN:AWE5:LU72:6JAI:ZPIQ:Z6UW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Console output

tep 7/12 : RUN $(npm bin)/ng build --prod --build-optimizer
 ---> Running in 2b296ba5cd4a
Date: 2018-04-13T11:28:45.181Z                                                          
Hash: 60163fe830976eae60d7
Time: 24622ms
chunk {0} polyfills.c551d6b1e1d6192ebe54.bundle.js (polyfills) 62.9 kB {3} [initial] [rendered]
chunk {1} main.8d9177809be9dc925c95.bundle.js (main) 61.6 kB {3} [initial] [rendered]
chunk {2}  (styles) {3} [initial] [rendered]
chunk {3} inline.2aa72ff0f07af8700ffb.bundle.js (inline) 1.45 kB [entry] [rendered]

ERROR in ./src/styles.sass
Module build failed: Error: Cannot find module 'node-sass'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/ng-app/node_modules/sass-loader/lib/loader.js:3:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:173:18
 @ multi ./src/styles.sass
ERROR in Child compilation failed:
Module build failed: Error: Cannot find module 'node-sass'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/ng-app/node_modules/sass-loader/lib/loader.js:3:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:173:18:
Error: Cannot find module 'node-sass'
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/ng-app/src'
resolve './$$_gendir/app/app.module.ngfactory' in '/ng-app/src'
  using description file: /ng-app/package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /ng-app/package.json (relative path: ./src)
    using description file: /ng-app/package.json (relative path: ./src/$$_gendir/app/app.module.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /ng-app/src/$$_gendir/app/app.module.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /ng-app/src/$$_gendir/app/app.module.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /ng-app/src/$$_gendir/app/app.module.ngfactory.js doesn't exist
      as directory
        /ng-app/src/$$_gendir/app/app.module.ngfactory doesn't exist
[/ng-app/src/$$_gendir/app/app.module.ngfactory]
[/ng-app/src/$$_gendir/app/app.module.ngfactory.ts]
[/ng-app/src/$$_gendir/app/app.module.ngfactory.js]
[/ng-app/src/$$_gendir/app/app.module.ngfactory]
 @ ./src/main.ts 3:0-74
 @ multi ./src/main.ts
ERROR in ./src/styles.sass
Module build failed: ModuleBuildError: Module build failed: Error: Cannot find module 'node-sass'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/ng-app/node_modules/sass-loader/lib/loader.js:3:14)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at runLoaders (/ng-app/node_modules/webpack/lib/NormalModule.js:194:19)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:364:11
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:170:18
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:27:11)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
    at /ng-app/node_modules/loader-runner/lib/LoaderRunner.js:173:18
    at loadLoader (/ng-app/node_modules/loader-runner/lib/loadLoader.js:36:3)
    at iteratePitchingLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/ng-app/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/ng-app/node_modules/webpack/lib/NormalModule.js:181:3)
    at NormalModule.build (/ng-app/node_modules/webpack/lib/NormalModule.js:274:15)
The command '/bin/sh -c $(npm bin)/ng build --prod --build-optimizer' returned a non-zero code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.