Skip to content

Commit

Permalink
chore(docker): faster build, prod setup only
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Oct 3, 2018
1 parent caea169 commit 4e0c748
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NODE_ENV=development
API_URL=http://127.0.0.1:1337/api/v1
PORT=3000
PORT=3000
12 changes: 7 additions & 5 deletions docker/prod/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
FROM node:10.8.0-alpine

COPY . /app
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json

WORKDIR /app

RUN npm install

ARG NODE_ENV
COPY . /app

ARG API_URL
ARG PORT
ARG NODE_ENV

ENV NODE_ENV=$NODE_ENV
# for javascript browser build
ENV API_URL=$API_URL
ENV PORT=$PORT
ENV NODE_ENV=$NODE_ENV

RUN npm run build

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code-du-travail Explorer [![CircleCI](https://circleci.com/gh/SocialGouv/code-du-travail-explorer.svg?style=svg)](https://circleci.com/gh/SocialGouv/code-du-travail-explorer)
# Code-du-travail Frontend [![CircleCI](https://circleci.com/gh/SocialGouv/code-du-travail-explorer.svg?style=svg)](https://circleci.com/gh/SocialGouv/code-du-travail-explorer)

Ce dépôt de code contient le site web du prototype du Code du Travail Numérique.
Ce dépôt de code contient le frontend du site web du Code du Travail Numérique.

- Prototype dispo sur : https://codedutravail-dev.num.social.gouv.fr

Expand All @@ -13,6 +13,7 @@ Créez un fichier `.env` :
```shell
NODE_ENV=development
API_URL=https://127.0.0.1:1337
PORT=3000
```

Puis :
Expand Down
20 changes: 5 additions & 15 deletions docker-compose.override.yml.sample
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
version: '3'

services:
networks:

node:
container_name: code-du-travail-explorer
env_file:
- .env
build:
context: .
dockerfile: ./docker/prod/Dockerfile
args:
NODE_ENV: $NODE_ENV
API_URL: $API_URL
PORT: $PORT
ports:
- $PORT:$PORT
restart: always
default:
# The network used by the repository `code-du-travail-data` must be active first.
external:
name: codedutravaildata_default
8 changes: 1 addition & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ services:
- .env
build:
context: .
dockerfile: ./docker/prod/Dockerfile
dockerfile: ./Dockerfile
args:
NODE_ENV: $NODE_ENV
API_URL: $API_URL
PORT: $PORT
ports:
- $PORT:$PORT
restart: always
volumes:
- ./pages:/app/pages
- ./routes.js:/app/routes.js
- ./src:/app/src
- ./static:/app/static
19 changes: 0 additions & 19 deletions docker/dev/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion env-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
"process.env.NODE_ENV": process.env.NODE_ENV,
"process.env.API_URL": process.env.API_URL
"process.env.API_URL": process.env.API_URL,
"process.env.SENTRY_PUBLIC_DSN": process.env.SENTRY_PUBLIC_DSN
};
13 changes: 6 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const withCSS = require("@zeit/next-css");
const withImages = require("next-images");
//const withImages = require("next-images");

require("dotenv").config();

module.exports = withImages(
withCSS({
// use routes.js
useFileSystemPublicRoutes: false
})
);
module.exports = withCSS({
// use routes.js
useFileSystemPublicRoutes: false,
poweredByHeader: false
});
52 changes: 42 additions & 10 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"next": "^7.0.0",
"next-images": "^1.0.0",
"next-routes": "^1.4.2",
"react": "^16.3.2",
"react": "^16.5.2",
"react-autosuggest": "9.3.4",
"react-delay": "^0.1.0",
"react-dom": "16.3.2",
"react-dom": "^16.5.2",
"react-feather": "1.1.0",
"react-github-fork-ribbon": "0.5.1",
"react-modal": "^3.4.4",
Expand Down

0 comments on commit 4e0c748

Please sign in to comment.