Created
October 10, 2019 12:36
-
-
Save BrychanOdlum/c18e5000498ac7e2f1fcb789b21e2e5e to your computer and use it in GitHub Desktop.
Dockerfile
This file contains hidden or 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
FROM node:10-alpine AS base | |
WORKDIR /app | |
# Add python... because bcrypt... | |
RUN apk --no-cache add --virtual native-deps \ | |
g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python git && \ | |
npm install --quiet node-gyp -g | |
FROM base AS build | |
# Copy package config | |
COPY package.json ./ | |
COPY yarn.lock ./ | |
# First, install prod dependencies for use in release | |
RUN yarn install --pure-lockfile --production | |
RUN cp -R node_modules /tmp/node_modules | |
# And now lets install the dev dependencies | |
RUN yarn install --pure-lockfile | |
# Bundle in our app sources/resources | |
COPY . . | |
# Test... | |
RUN yarn test | |
# Build project (transpilation) | |
RUN yarn build | |
FROM base AS release | |
COPY --from=build /tmp/node_modules ./node_modules | |
COPY --from=build /app/dist ./dist | |
COPY --from=build /app/package.json ./ | |
# Expose app port | |
EXPOSE 8080 | |
# And declare our container's entrypoint | |
ENTRYPOINT yarn start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment