Docker and gulp

I am using Windows 7 and have a virtual machine running on boot2docker.

Docker-compose.yml :

web:
    image: nginx
    ports:
        - "80:80"
    volumes:
        - /var/www/docker/nginx/:/etc/nginx/conf.d/
        - /var/www/:/var/www/html/
    links:
        - php:php

php:
    build: php
    volumes:
        - /var/www/:/var/www/html/
        - /var/www/docker/php.ini:/usr/local/etc/php/php.ini
        - /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock
    links:
        - db:db

db:
    image: mysql
    ports:
        - "13306:3306"
    volumes:
        - /var/lib/boot2docker/mysql/:/var/lib/mysql/
    environment:
        - MYQSL_ROOT_PASSWORD=root

gulpfile.js

var gulp = require('gulp');
var postcss = require('gulp-postcss');

var processors = [
  require('precss'),
  require('autoprefixer')({browsers: ['last 2 versions'] }),
  require('cssnano')
];

gulp.task('postcss', function() {
  gulp.src('gulp/stylesheets/*.css')
    .pipe(postcss(processors))
    .pipe(gulp.dest('assets/stylesheets/'))
});

gulp.task('watch-postcss', function() {
  gulp.watch("gulp/stylesheets/*.css", ["postcss"]);
});

I am trying to run Gulp to compile my CSS files using postcss outside of VM, but it seems to be splitting my output file in my VM shared folder. For example, if I compile this:

body {
  background: red;
}

I get this in the output file (this is what I want):

body{background:red}

But if I recompile the postcss stylesheet as follows:

body {
  text-align: center;
}

I get this in my output file:

body{background:red}   

My local (Windows) file is updated correctly, this error is only in the file inside the VM shared folder.

I am new to Docker and don't know what I'm doing wrong. Should I run Gulp inside a virtual machine? Or inside the container? And if so, how do I install and use Gulp inside my VM / container?

, , - ?

+4
1

, nginx. sendfile off; nginx.

0

Source: https://habr.com/ru/post/1618724/


All Articles