1
0
ohmyform/Dockerfile

74 lines
1.8 KiB
Docker
Raw Permalink Normal View History

## Build UI
2023-12-11 06:53:20 -08:00
FROM node:20-alpine as ui
2019-07-15 07:30:35 -07:00
WORKDIR /usr/src/ui
2022-02-28 00:08:10 -08:00
RUN apk --update --no-cache add curl bash g++ make libpng-dev
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
COPY ui/ .
2016-08-17 12:04:42 -07:00
RUN yarn install --frozen-lockfile
RUN yarn build
# remove development dependencies
RUN npm prune --production
2019-07-15 06:02:21 -07:00
# run node prune
# there is some problem running node prune that then prevents the frontend to load (just start with /form/1 and it will crash)
#RUN /usr/local/bin/node-prune
## Build API
2023-12-11 06:53:20 -08:00
FROM node:20-alpine as api
2020-06-01 13:11:00 -07:00
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
WORKDIR /usr/src/api
2023-12-11 06:53:32 -08:00
RUN apk --update --no-cache add curl bash g++ make libpng-dev python3
2020-06-16 01:45:52 -07:00
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sf https://gobinaries.com/tj/node-prune | sh
2020-06-16 01:45:52 -07:00
COPY api/ .
RUN touch /usr/src/api/src/schema.gql && chown 9999:9999 /usr/src/api/src/schema.gql
RUN yarn install --frozen-lockfile
RUN yarn build
2020-06-16 01:45:52 -07:00
# remove development dependencies
RUN npm prune --production
# run node prune
RUN /usr/local/bin/node-prune
2020-06-15 23:52:24 -07:00
## Production Image.
2023-12-11 06:53:20 -08:00
FROM node:20-alpine
2020-06-15 23:52:24 -07:00
RUN apk --update add supervisor nginx && rm -rf /var/cache/apk/*
WORKDIR /usr/src
COPY --from=api /usr/src/api /usr/src/api
COPY --from=ui /usr/src/ui /usr/src/ui
2020-06-16 01:45:52 -07:00
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
ENV SECRET_KEY=ChangeMe \
CREATE_ADMIN=FALSE \
ADMIN_EMAIL=admin@ohmyform.com \
ADMIN_USERNAME=root \
2022-01-02 15:58:36 -08:00
ADMIN_PASSWORD=root \
NODE_ENV=production
EXPOSE 3000
RUN mkdir -p /run/nginx/
RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log
COPY supervisord.conf /etc/supervisord.conf
2022-01-13 07:47:35 -08:00
COPY nginx.conf /etc/nginx/nginx.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
# CMD [ "yarn", "start:prod" ]