Skip to content

Instantly share code, notes, and snippets.

@acro5piano
Created December 27, 2016 01:33
Show Gist options
  • Save acro5piano/c99c562170d93720020c8bf4dfd2ec5a to your computer and use it in GitHub Desktop.
Save acro5piano/c99c562170d93720020c8bf4dfd2ec5a to your computer and use it in GitHub Desktop.
DockerコンテナでGulpを動かす ref: http://qiita.com/acro5piano/items/94d10be1c58be5113407
web:
build: ./docker/web
links:
- db
volumes:
- ./:/app
ports:
- "8000:8000"
db:
build: ./docker/db
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: hoge
MYSQL_USER: hoge
MYSQL_PASSWORD: hoge
nodejs:
build: ./docker/nodejs
volumes:
- ./:/app
FROM node:latest
RUN npm install -g gulp
WORKDIR /app
CMD gulp watch
app
|-- index.php
|-- gulpfile.js <-- これ
|-- docker-compose.yml
`-- docker
|-- db
| |-- Dockerfile
| `-- my.cnf
|-- nodejs
| `-- Dockerfile <-- これ
`-- web
`-- Dockerfile
docker-compose up -d
docker-compose run nodejs npm install
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('watch', function() {
return gulp.src('./**/*.scss')
.pipe($.plumber())
.pipe($.sass())
.pipe($.pleeease({
autoprefixer: {
browsers: ['last 2 versions', 'android >= 4', 'ios >= 8']
},
minifier: true,
}))
.pipe(gulp.dest('public/assets/css'));
});
<html>
<head>
<link type="text/css" rel="stylesheet" href="/assets/css/style.min.css">
</head>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment