Skip to content

Commit

Permalink
Setup de preprod
Browse files Browse the repository at this point in the history
- https://deviensdev-preprod.nico.oclock.io/
- déploiement sur PaaS Dokku (deviensdev-preprod)
- variables d'environnements :
  - DEVIENSDEV_GITHUB_TOKEN=...
  - ENV=production
  - NODE_ENV=production
- mapping de ports http:80:80 https:443:80
- Fix: "gatsby build" plante à cause de la gestion de .mjs par Wepback 4

@see gatsbyjs/gatsby#8583 (comment)
  • Loading branch information
chikamichi committed Nov 16, 2018
1 parent c575a95 commit e44f453
Show file tree
Hide file tree
Showing 268 changed files with 10,071 additions and 2,777 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.cache
CHANGELOG.md
.circleci
CONTRIBUTING.md
.git
.gitignore
LICENSE
node_modules
public
README.md
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ Thumbs.db
/.cache

# Build Compiled.
/public
# /public

# Logs
/*.log

# Config
/config/index.js

#/config/index.js
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM oclock/static-nginx-nodejs

# Workaround node-gyp requiring make, gcc, g++ & python:
RUN apk update && \
apk add --no-cache --update alpine-sdk python yarn

# Workaround for error: "ERR! sharp Use with musl libc requires manual installation of libvips >= 8.6.1"
# => http://sharp.pixelplumbing.com/en/stable/install/#alpine-linux
# RUN apk add vips-dev fftw-dev build-base --update-cache --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
# https://bugs.alpinelinux.org/issues/9561 => add edge/main for some of the sub-dependencies
# https://bugs.alpinelinux.org/issues/8087 => don't use https:// for --repository URLs
RUN apk add vips-dev fftw-dev build-base \
--update-cache \
--repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \
--repository http://dl-3.alpinelinux.org/alpine/edge/main \
--allow-untrusted

COPY . /src
COPY bin/production-build.sh /bin/production-build.sh

WORKDIR /var/www
ARG NODE_ENV=production
RUN /bin/production-build.sh
16 changes: 16 additions & 0 deletions bin/production-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# node-gyp is required by gatsby but not in the project's package.json (add it?)
yarn global add node-gyp

# Building the static website :)
cd /src
yarn --pure-lockfile --non-interactive
rm -rf ./public
./node_modules/.bin/gatsby build

# Building the static website inside the container requires moving the public/
# output to /var/www, which has to work around the * expansion limitation inside
# running containers not running commands through a shell.
# @see https://stackoverflow.com/questions/44390360/mv-command-throwing-error-but-executing-fine-in-docker
sh -c "mv public/* /var/www/"
3 changes: 3 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
GITHUB_TOKEN: process.env.DEVIENSDEV_GITHUB_TOKEN,
};
10 changes: 10 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,21 @@ exports.onCreateWebpackConfig = ({ actions }) => {
},

resolve: {
// mainFields: ["main", "module"], // déclenche l'affichage de la stackframe
alias: {
src: path.resolve(__dirname, 'src'),
config: path.resolve(__dirname, 'config'),
},
},
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
],
},
});
};

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"eslint-plugin-react": "^7.6.1",
"husky": "^0.14.3",
"lint-staged": "^7.3.0",
"prettier": "^1.14.3"
"prettier": "^1.14.3",
"webpack": "^4.20.2"
}
}
2 changes: 2 additions & 0 deletions public/0-271471cd12703c44ff35.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/0-271471cd12703c44ff35.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/0-833985f64254fbc9e466.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/0-833985f64254fbc9e466.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/0-ac6be01b13de0f4cba11.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/0-ac6be01b13de0f4cba11.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/1-0518811edf52384baa8b.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/1-0518811edf52384baa8b.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/1-2e9dea2a42e94e847431.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/1-2e9dea2a42e94e847431.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/1-652edfcc4eca1c0d6b02.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/1-652edfcc4eca1c0d6b02.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/1-fcb61148794e66428734.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/1-fcb61148794e66428734.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/11-fc98873883386497c11a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/11-fc98873883386497c11a.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions public/12-72135d3a84b462a4787b.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/12-72135d3a84b462a4787b.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/13-617578c0f3f6666075cb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/13-617578c0f3f6666075cb.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions public/13-661c0a3682346f218613.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/13-661c0a3682346f218613.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions public/13-fea78b2ab0a1d64cc3ad.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/13-fea78b2ab0a1d64cc3ad.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e44f453

Please sign in to comment.