Created
September 28, 2021 04:02
-
-
Save realStandal/9b953c45d180020b20af3787321ca34d to your computer and use it in GitHub Desktop.
RedwoodJS API and Web-side Dockerfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#== | |
# Base | |
FROM node:14-alpine as base | |
WORKDIR /app | |
COPY package.json package.json | |
COPY yarn.lock yarn.lock | |
COPY redwood.toml redwood.toml | |
COPY graphql.config.js graphql.config.js | |
COPY babel.config.js babel.config.js | |
COPY api/package.json api/package.json | |
COPY web/package.json web/package.json | |
RUN yarn install --frozen-lockfile | |
#== | |
# Build | |
FROM base as api_build | |
COPY api api | |
RUN yarn rw build api | |
#== | |
# Serve | |
FROM node:14-alpine | |
WORKDIR /app | |
COPY api/package.json . | |
RUN yarn install && yarn add react react-dom && yarn global add @redwoodjs/api-server @redwoodjs/internal | |
COPY graphql.config.js . | |
COPY redwood.toml . | |
COPY api api | |
COPY --from=api_build /app/api/dist /app/api/dist | |
COPY --from=api_build /app/node_modules/.prisma /app/node_modules/.prisma | |
USER 1100:1100 | |
EXPOSE 8911 | |
ENTRYPOINT [ "rw-api-server" ] | |
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == | |
# Base | |
FROM node:14-alpine as base | |
WORKDIR /app | |
COPY package.json package.json | |
COPY yarn.lock yarn.lock | |
COPY redwood.toml redwood.toml | |
COPY graphql.config.js graphql.config.js | |
COPY babel.config.js babel.config.js | |
COPY api/package.json api/package.json | |
COPY web/package.json web/package.json | |
RUN yarn install --frozen-lockfile | |
#== | |
# Build | |
FROM base as web_build | |
COPY web web | |
# COPY .env .env | |
COPY config/cerberus/.env .env | |
RUN yarn rw build web | |
#== | |
# Serve | |
FROM node:14-alpine | |
WORKDIR /app | |
COPY --from=web_build /app/web/dist web/dist | |
RUN yarn global add local-web-server | |
USER 1100:1100 | |
EXPOSE 8910 | |
ENTRYPOINT [ "ws", "-d", "web/dist", "-s", "index.html", "-p", "8910" ] | |
CMD [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment