Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Reduce number of layers and provide an Alpine variant #1132

Merged
merged 2 commits into from
Jun 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 37 additions & 45 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,58 +1,50 @@
FROM golang:latest

RUN go version
RUN go get -v -u github.com/markbates/deplist/deplist

RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y build-essential nodejs
RUN apt-get install -y sqlite3 libsqlite3-dev
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
RUN wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add -
RUN apt-get install -y postgresql postgresql-contrib libpq-dev
RUN apt-get install -y -q mysql-client
RUN apt-get install -y vim

RUN go get -u github.com/golang/dep/cmd/dep
RUN go get -v -u github.com/gobuffalo/makr
RUN go get -v -u github.com/gobuffalo/packr
RUN go get -v -u github.com/gobuffalo/tags
RUN go get -v -u github.com/gobuffalo/pop
RUN go get -v -u github.com/gobuffalo/x/...
RUN go get -v -u github.com/mattn/go-sqlite3
RUN go get -v -u github.com/markbates/filetest
RUN go get -v -u github.com/markbates/grift
RUN go get -v -u github.com/markbates/inflect
RUN go get -v -u github.com/markbates/refresh
RUN go get -v -u github.com/markbates/willie
RUN go get -v -u github.com/gorilla/sessions
RUN go get -v -u golang.org/x/vgo
RUN go get -u github.com/alecthomas/gometalinter
RUN gometalinter --install

RUN npm install -g --no-progress yarn
RUN yarn config set yarn-offline-mirror /npm-packages-offline-cache
RUN yarn config set yarn-offline-mirror-pruning true

EXPOSE 3000
ENV BP=$GOPATH/src/github.com/gobuffalo/buffalo

RUN rm -rfv $BP
RUN mkdir -p $BP
RUN go version && go get -v -u github.com/markbates/deplist/deplist

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash \
&& sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' \
&& wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | apt-key add - \
&& apt-get update \
&& apt-get install -y -q build-essential nodejs sqlite3 libsqlite3-dev postgresql postgresql-contrib libpq-dev mysql-client vim \
&& rm -rf /var/lib/apt/lists/*


RUN go get -u github.com/golang/dep/cmd/dep \
&& go get -v -u github.com/gobuffalo/makr \
&& go get -v -u github.com/gobuffalo/packr \
&& go get -v -u github.com/gobuffalo/tags \
&& go get -v -u github.com/gobuffalo/pop \
&& go get -v -u github.com/gobuffalo/x/... \
&& go get -v -u github.com/mattn/go-sqlite3 \
&& go get -v -u github.com/markbates/filetest \
&& go get -v -u github.com/markbates/grift \
&& go get -v -u github.com/markbates/inflect \
&& go get -v -u github.com/markbates/refresh \
&& go get -v -u github.com/markbates/willie \
&& go get -v -u github.com/gorilla/sessions \
&& go get -v -u golang.org/x/vgo \
&& go get -u github.com/alecthomas/gometalinter \
&& gometalinter --install

RUN npm install -g --no-progress yarn \
&& yarn config set yarn-offline-mirror /npm-packages-offline-cache \
&& yarn config set yarn-offline-mirror-pruning true


RUN rm -rfv $BP && mkdir -p $BP
WORKDIR $BP

ADD . .
RUN go get -tags "sqlite" -v -t github.com/gobuffalo/buffalo/...
RUN make install

RUN go get -tags "sqlite" -v -t github.com/gobuffalo/buffalo/... && make install

# cache yarn packages to an offline mirror so they're faster to load. hopefully.
RUN grep -v '{{' ./generators/assets/webpack/templates/package.json.tmpl > package.json
RUN yarn install --no-progress
RUN grep -v '{{' ./generators/assets/webpack/templates/package.json.tmpl > package.json \
&& yarn install --no-progress

RUN buffalo version

WORKDIR $GOPATH/src

RUN ls -la /npm-packages-offline-cache

EXPOSE 3000
46 changes: 46 additions & 0 deletions Dockerfile.slim.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM golang:alpine
EXPOSE 3000
ENV BP=$GOPATH/src/github.com/gobuffalo/buffalo
RUN apk add --no-cache --upgrade apk-tools \
&& apk add --no-cache bash curl openssl git build-base yarn nodejs postgresql libpq postgresql-contrib sqlite sqlite-dev mysql-client vim

RUN go version && go get -v -u github.com/markbates/deplist/deplist


RUN go get -u github.com/golang/dep/cmd/dep \
&& go get -v -u github.com/gobuffalo/makr \
&& go get -v -u github.com/gobuffalo/packr \
&& go get -v -u github.com/gobuffalo/tags \
&& go get -v -u github.com/gobuffalo/pop \
&& go get -v -u github.com/gobuffalo/x/... \
&& go get -v -u github.com/mattn/go-sqlite3 \
&& go get -v -u github.com/markbates/filetest \
&& go get -v -u github.com/markbates/grift \
&& go get -v -u github.com/markbates/inflect \
&& go get -v -u github.com/markbates/refresh \
&& go get -v -u github.com/markbates/willie \
&& go get -v -u github.com/gorilla/sessions \
&& go get -v -u golang.org/x/vgo \
&& go get -u github.com/alecthomas/gometalinter \
&& gometalinter --install

RUN npm install -g --no-progress yarn \
&& yarn config set yarn-offline-mirror /npm-packages-offline-cache \
&& yarn config set yarn-offline-mirror-pruning true


RUN rm -rfv $BP && mkdir -p $BP
WORKDIR $BP

ADD . .
RUN go get -tags "sqlite" -v -t github.com/gobuffalo/buffalo/... && make install

# cache yarn packages to an offline mirror so they're faster to load. hopefully.
RUN grep -v '{{' ./generators/assets/webpack/templates/package.json.tmpl > package.json \
&& yarn install --no-progress

RUN buffalo version

WORKDIR $GOPATH/src

RUN ls -la /npm-packages-offline-cache