Skip to content

Commit 1fd4d71

Browse files
committed
Add Dockerfile and associated files
1 parent b85bec2 commit 1fd4d71

File tree

6 files changed

+99
-1
lines changed

6 files changed

+99
-1
lines changed

.docker/nginx.conf

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
worker_processes 1;
2+
3+
error_log /var/log/nginx/error.log warn;
4+
pid /var/run/nginx.pid;
5+
6+
events {
7+
worker_connections 1024;
8+
}
9+
10+
http {
11+
include /etc/nginx/mime.types;
12+
default_type application/octet-stream;
13+
14+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
15+
'$status $body_bytes_sent "$http_referer" '
16+
'"$http_user_agent" "$http_x_forwarded_for"';
17+
18+
access_log /var/log/nginx/access.log main;
19+
20+
sendfile on;
21+
keepalive_timeout 65;
22+
23+
server {
24+
listen 8080 default_server;
25+
auth_basic "Authentication required";
26+
auth_basic_user_file /etc/nginx/htpasswd;
27+
28+
location / {
29+
root /var/www;
30+
index index.html;
31+
try_files $uri $uri/ /index.html =404;
32+
}
33+
}
34+
}

.docker/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow: /

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git

Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM node:10.16-buster AS builder
2+
3+
WORKDIR /tmp
4+
5+
COPY package.json lerna.json yarn.lock tsconfig.json tslint.json ./
6+
COPY configs ./configs
7+
COPY packages ./packages/
8+
9+
RUN yarn install \
10+
&& yarn build:site
11+
12+
13+
FROM nginx:1.17
14+
15+
ARG WEBROOT=/var/www
16+
17+
COPY --from=builder /tmp/packages/site-demo/dist $WEBROOT
18+
COPY .docker/nginx.conf /etc/nginx/nginx.conf
19+
COPY .docker/robots.txt ${WEBROOT}
20+
21+
WORKDIR $WEBROOT
22+
23+
RUN touch /var/run/nginx.pid \
24+
&& chown -R www-data:www-data /var/run/nginx.pid \
25+
&& chown -R www-data:www-data /var/cache/nginx \
26+
&& chmod -R 644 $WEBROOT/* \
27+
&& chmod -R +X $WEBROOT \
28+
&& chown -R root:www-data $WEBROOT
29+
30+
USER www-data
31+
32+
EXPOSE 8080

Makefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
SHELL := /bin/bash
2+
.DEFAULT_GOAL := help
3+
4+
# Configure the Docker commands
5+
DOCKER_EXEC:=docker
6+
7+
# Use for docker image build
8+
GIT_VERSION = $(shell git describe --abbrev=0 --tags)
9+
BUILD_DATE=$(shell date --rfc-3339=seconds)
10+
GIT_COMMIT=$(shell git rev-parse HEAD)
11+
DOCKER_REGISTRY=gcr.io/lumapps-registry
12+
DOCKER_IMAGE_CANONICAL=$(DOCKER_REGISTRY)/design-system:$(GIT_COMMIT)
13+
DOCKER_IMAGE_HUMAN_READABLE=$(DOCKER_REGISTRY)/design-system:$(GIT_VERSION)
14+
15+
DOCKER_LABELS= --label="com.lumapps.image.created=$(BUILD_DATE)" \
16+
--label=com.lumapps.image.sha1=$(GIT_SHA1) \
17+
--label=com.lumapps.image.version=$(GIT_VERSION) \
18+
19+
20+
docker_build:
21+
$(DOCKER_EXEC) build $(DOCKER_LABELS) -t $(DOCKER_IMAGE_CANONICAL) -t ${DOCKER_IMAGE_HUMAN_READABLE} .
22+
23+
docker_push:
24+
$(DOCKER_EXEC) push $(DOCKER_IMAGE_CANONICAL)
25+
$(DOCKER_EXEC) push $(DOCKER_IMAGE_HUMAN_READABLE)
26+
27+
# autodocument makefiles
28+
help:
29+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"eslint-plugin-html": "^5.0.3",
3232
"eslint-plugin-import": "^2.16.0",
3333
"eslint-plugin-jsx-a11y": "^6.2.1",
34-
"eslint-plugin-lumapps": "git+ssh://git@github.com/lumapps/eslint-plugin-lumapps.git#master",
34+
"eslint-plugin-lumapps": "https://github.com/lumapps/eslint-plugin-lumapps",
3535
"eslint-plugin-no-useless-assign": "^1.0.2",
3636
"eslint-plugin-prettier": "^3.0.1",
3737
"eslint-plugin-react": "^7.12.4",

0 commit comments

Comments
 (0)