-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
64 lines (57 loc) · 1.76 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
56
57
58
59
60
61
62
63
64
# syntax=docker/dockerfile:1.3
# Install dependencies only when needed
FROM node:16-bullseye-slim AS deps
WORKDIR /app
RUN apt-get update && \
apt-get install -yqq git bash curl
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
FROM node:16-bullseye-slim AS runner
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED="1" \
NODE_ENV="production" \
NEXT_PUBLIC_STRIPE_PUBLIC_KEY="pk_live_B2ylJU30kGz2y0k20LHiZhA7"
# \
# SSL_KEY_FILE="/app/secrets/tls.key" \
# SSL_CRT_FILE="/app/secrets/tls.crt"
RUN apt-get update -yqq && \
apt-get install -yqq awscli && \
chown -R node:node /app
# mkdir -p /app/secrets && \
USER node
COPY --chown=node:node --from=deps /app/node_modules ./node_modules
COPY --chown=node:node public ./public
COPY --chown=node:node config ./config
COPY --chown=node:node styles ./styles
COPY --chown=node:node lib ./lib
COPY --chown=node:node components ./components
COPY --chown=node:node pages ./pages
COPY --chown=node:node *.js *.json *.md ./
# COPY --chown=node:node package.json tls.cr[t] tls.ke[y] /app/secrets/
EXPOSE 3000
# VOLUME ["/app/secrets"]
RUN yarn build
CMD ["bash", "-c", "yarn start"]
FROM runner AS dev
CMD ["bash", "-c", "yarn dev"]
# FROM runner AS deployer
# WORKDIR /app
# ENV NEXT_TELEMETRY_DISABLED="1" \
# NODE_ENV="production"
# ARG AWS_BUCKET=pibox.io
# ARG AWS_ACCESS_KEY_ID
# ARG AWS_SECRET_ACCESS_KEY
# RUN yarn build
# && aws s3 sync \
# --size-only \
# --exclude "*" \
# --include="*/*.png" \
# --include="*/*.json" \
# --include "*/*.svg" \
# --include "*/*.jpg" \
# --include "*/*.obj" \
# --include "*/*.mtl" \
# --cache-control public,max-age=31536000,stale-while-revalidate=3600,stale-if-error=3600,immutable \
# .next/static/ s3://${AWS_BUCKET}/_next/static/ \
# --no-progress \
# --acl public-read