-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
43 lines (31 loc) · 1.38 KB
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
FROM node:krypton-alpine AS base
ENV NODE_ENV=production YARN_VERSION=4.13.0 NPM_CONFIG_UPDATE_NOTIFIER=false
# install and use yarn 4.x
RUN corepack enable && corepack prepare yarn@${YARN_VERSION} && yarn set version ${YARN_VERSION}
FROM base AS build
WORKDIR /app
COPY .yarnrc.yml ./
COPY .yarn/ ./.yarn/
COPY package.json yarn.lock ./
# Cache mount for Yarn with Railway specific ID format
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,id=s/d5ca8ab0-23ab-4d0e-bfd3-5735cee08a86-/usr/local/share/.cache/yarn,sharing=locked \
YARN_CACHE_FOLDER=/usr/local/share/.cache/yarn yarn install --immutable
COPY . .
ARG PUBLIC_POSTHOG_KEY
ENV PUBLIC_POSTHOG_KEY=$PUBLIC_POSTHOG_KEY
ARG PUBLIC_POSTHOG_COOKIE_MODE
ENV PUBLIC_POSTHOG_COOKIE_MODE=$PUBLIC_POSTHOG_COOKIE_MODE
ARG PUBLIC_MEET_LINK
ENV PUBLIC_MEET_LINK=$PUBLIC_MEET_LINK
RUN --mount=type=cache,target=/app/node_modules/.astro,id=s/d5ca8ab0-23ab-4d0e-bfd3-5735cee08a86-/app/node_modules/.astro \
yarn build
FROM nginx:alpine-slim AS runtime
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /app/dist /usr/share/nginx/html
# Pre-compress static files for gzip_static
RUN find /usr/share/nginx/html -type f \
\( -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.xml" \
-o -name "*.svg" -o -name "*.json" -o -name "*.txt" \) \
-exec gzip -9 -k {} \;
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]