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

Commit

Permalink
Switch the base image to use alpine-based golang base image.
Browse files Browse the repository at this point in the history
This should reduce the size of the image. The number of layers has also been cut.
  • Loading branch information
robbyoconnor committed Jun 22, 2018
1 parent 20f8245 commit cc59dad
Showing 1 changed file with 34 additions and 46 deletions.
80 changes: 34 additions & 46 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,58 +1,46 @@
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

FROM golang:alpine
EXPOSE 3000
ENV BP=$GOPATH/src/github.com/gobuffalo/buffalo

RUN rm -rfv $BP
RUN mkdir -p $BP
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/...
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

0 comments on commit cc59dad

Please sign in to comment.