- switched to supervisord based combined container
- heroku deployments
This commit is contained in:
parent
46760ae135
commit
5414f3b371
@ -11,8 +11,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
|
||||
- switched to supervisord based combined container
|
||||
|
||||
### Fixed
|
||||
|
||||
- heroku deployments
|
||||
|
||||
### Security
|
||||
|
||||
## [0.9.9] - 2021-02-14
|
||||
|
68
Dockerfile
68
Dockerfile
@ -1,27 +1,14 @@
|
||||
## Build API
|
||||
FROM node:14-alpine as api
|
||||
## Build UI
|
||||
FROM node:14-alpine as ui
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY ui/ .
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn export
|
||||
|
||||
## Build APP
|
||||
FROM node:14-alpine as app
|
||||
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
WORKDIR /usr/src/ui
|
||||
|
||||
RUN apk update && apk add curl bash && rm -rf /var/cache/apk/*
|
||||
|
||||
# install node-prune (https://github.com/tj/node-prune)
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
|
||||
|
||||
|
||||
COPY api/ .
|
||||
COPY --from=api /usr/src/app/out /usr/src/app/public
|
||||
COPY ui/ .
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn build
|
||||
@ -32,22 +19,53 @@ RUN npm prune --production
|
||||
# run node prune
|
||||
RUN /usr/local/bin/node-prune
|
||||
|
||||
## Glue
|
||||
RUN touch /usr/src/app/src/schema.gql && chown 9999:9999 /usr/src/app/src/schema.gql
|
||||
## Build API
|
||||
FROM node:14-alpine as api
|
||||
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
|
||||
|
||||
WORKDIR /usr/src/api
|
||||
|
||||
RUN apk --update add curl bash && rm -rf /var/cache/apk/*
|
||||
|
||||
# install node-prune (https://github.com/tj/node-prune)
|
||||
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
|
||||
|
||||
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
|
||||
|
||||
# remove development dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
# run node prune
|
||||
RUN /usr/local/bin/node-prune
|
||||
|
||||
## Production Image.
|
||||
FROM node:14-alpine
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
COPY --from=app /usr/src/app /usr/src/app
|
||||
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
|
||||
|
||||
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
|
||||
ENV PORT=3000 \
|
||||
SECRET_KEY=ChangeMe \
|
||||
ENV SECRET_KEY=ChangeMe \
|
||||
CREATE_ADMIN=FALSE \
|
||||
ADMIN_EMAIL=admin@ohmyform.com \
|
||||
ADMIN_USERNAME=root \
|
||||
ADMIN_PASSWORD=root
|
||||
|
||||
EXPOSE 3000
|
||||
USER ohmyform
|
||||
CMD [ "yarn", "start:prod" ]
|
||||
|
||||
RUN mkdir /run/nginx/
|
||||
RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log
|
||||
COPY supervisord.conf /etc/supervisord.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d/ohmyform.conf
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
|
||||
# CMD [ "yarn", "start:prod" ]
|
||||
|
2
api
2
api
@ -1 +1 @@
|
||||
Subproject commit e1670223cfb84e221be15e820761640e6916e6f4
|
||||
Subproject commit 9327514e8345b1ef1e656610246a981fe93ac33c
|
6
app.json
6
app.json
@ -34,7 +34,7 @@
|
||||
},
|
||||
"LOGIN_NOTE": {
|
||||
"description": "Note next to login form",
|
||||
"value": "Either login with root:root or create your own account to test OhMyForm\n\nData will be deleted at arbitrary intervals!"
|
||||
"value": "Welcome to your new OhMyForm instance, you can remove this login note in the dyno configuration!"
|
||||
},
|
||||
"ADMIN_PASSWORD": {
|
||||
"description": "Password for your default admin account",
|
||||
@ -55,6 +55,10 @@
|
||||
"DATABASE_DRIVER": {
|
||||
"description": "Database Driver to use",
|
||||
"value": "postgres"
|
||||
},
|
||||
"DATABASE_SSL": {
|
||||
"description": "Use SSL Connection for database",
|
||||
"value": "true"
|
||||
}
|
||||
},
|
||||
"addons": [
|
||||
|
@ -7,37 +7,33 @@ version: "3"
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
mongo:
|
||||
image: mongo
|
||||
volumes:
|
||||
- "./data/mongo:/data/db"
|
||||
ohmyform:
|
||||
build: .
|
||||
environment:
|
||||
CREATE_ADMIN: "TRUE"
|
||||
MONGODB_URI: mongodb://mongo/ohmyform
|
||||
MAILER_URI: smtp://mail:1025
|
||||
PORT: 5000
|
||||
DATABASE_DRIVER: postgres
|
||||
DATABASE_URL: postgresql://root:root@db:5432/ohmyform
|
||||
LOGIN_NOTE: "login with root:root!"
|
||||
SECRET_KEY: 12345
|
||||
links:
|
||||
- mongo
|
||||
- db
|
||||
- redis
|
||||
- mail
|
||||
ports:
|
||||
- "5000:5000"
|
||||
- "5200:3000"
|
||||
depends_on:
|
||||
- mongo
|
||||
- db
|
||||
- redis
|
||||
mail:
|
||||
image: mailhog/mailhog
|
||||
ports:
|
||||
- "5050:8025"
|
||||
mongoexpress:
|
||||
image: mongo-express
|
||||
- "5051:8025"
|
||||
db:
|
||||
image: postgres:10-alpine
|
||||
volumes:
|
||||
- ./pg_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_SERVER: mongo
|
||||
ports:
|
||||
- "5051:8081"
|
||||
links:
|
||||
- mongo
|
||||
depends_on:
|
||||
- mongo
|
||||
POSTGRES_USER: root
|
||||
POSTGRES_PASSWORD: root
|
||||
POSTGRES_DB: ohmyform
|
||||
|
15
nginx.conf
Normal file
15
nginx.conf
Normal file
@ -0,0 +1,15 @@
|
||||
server {
|
||||
listen 3000;
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:4000;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location /graphql {
|
||||
proxy_pass http://localhost:4100;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
25
supervisord.conf
Normal file
25
supervisord.conf
Normal file
@ -0,0 +1,25 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:ui]
|
||||
directory=/usr/src/ui
|
||||
command=yarn next start -p 4000
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:api]
|
||||
directory=/usr/src/api
|
||||
command=yarn start:prod
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:nginx]
|
||||
command=nginx -g "daemon off;"
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/fd/1
|
||||
stderr_logfile_maxbytes=0
|
2
ui
2
ui
@ -1 +1 @@
|
||||
Subproject commit 3d3614b88abf020f9435cf81e6b19420e95108c3
|
||||
Subproject commit c6cf6783b41333073169fc7c9bbc36df45a0047d
|
Loading…
x
Reference in New Issue
Block a user