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

Commit

Permalink
Fix the alpine-based Docker image (#1297)
Browse files Browse the repository at this point in the history
* Fix the alpine-based Docker image

- alpine needs to explicitly install npm as a sep. package
- Use COPY over ADD to copy in the project code,
  see https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy

* Use COPY over ADD in both Dockerfile and Dockerfile.build

Rationale can be found here:
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy

* Update Dockerfile.slim.build
  • Loading branch information
robbyoconnor authored and markbates committed Sep 18, 2018
1 parent 01958bf commit 103e0ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN rm $(which buffalo)
RUN rm -rf $BP
RUN mkdir -p $BP
WORKDIR $BP
ADD . .
COPY . .

RUN go get github.com/gobuffalo/buffalo-pop
RUN make deps
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ RUN npm install -g --no-progress yarn \

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

ADD . .
COPY . .
RUN make deps && 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
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.slim.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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
&& apk add --no-cache bash curl openssl git build-base nodejs npm postgresql libpq postgresql-contrib sqlite sqlite-dev mysql-client vim

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

Expand All @@ -24,16 +24,16 @@ RUN go get -u github.com/golang/dep/cmd/dep \
&& go get -u github.com/alecthomas/gometalinter \
&& gometalinter --install

RUN npm install -g --no-progress yarn \
RUN npm i -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
COPY . .
RUN make deps && 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 \
Expand Down

0 comments on commit 103e0ce

Please sign in to comment.