forked from canonical/netplan.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (44 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# syntax=docker/dockerfile:experimental
# Build stage: Install yarn dependencies
# ===
FROM node:14 AS yarn-dependencies
WORKDIR /srv
ADD package.json .
ADD yarn.lock .
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install
# Build stage: Run "yarn run build-js"
# ===
FROM yarn-dependencies AS build-js
WORKDIR /srv
COPY src .
RUN yarn run build-js
# Build stage: Run "yarn run build-css"
# ===
FROM yarn-dependencies AS build-css
WORKDIR /srv
COPY src/sass src/sass
RUN yarn run build-css
# Build stage: Run "yarn run build-site"
# ===
FROM yarn-dependencies AS build-site
WORKDIR /srv
COPY src/ src/
COPY .eleventy.js .
COPY --from=build-css /srv/src/css src/css
COPY --from=build-js /srv/src/js src/js
RUN yarn run build-site
# Build the production image
# ===
FROM ubuntu:focal
# Set up environment
ENV LANG C.UTF-8
WORKDIR /srv
# Install nginx
RUN apt-get update && apt-get install --no-install-recommends --yes nginx
# Import code, build assets and mirror list
COPY --from=build-site srv/_site .
ARG BUILD_ID
ADD nginx.conf /etc/nginx/sites-enabled/default
RUN sed -i "s/~BUILD_ID~/${BUILD_ID}/" /etc/nginx/sites-enabled/default
STOPSIGNAL SIGTERM
CMD ["nginx", "-g", "daemon off;"]