Skip to content

Commit

Permalink
Docker: deployment script generalised to support 3rd party separate d…
Browse files Browse the repository at this point in the history
…eployments
  • Loading branch information
choxx committed Jan 12, 2023
1 parent 1adf187 commit 6172121
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
30 changes: 25 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
FROM node:16 As development
WORKDIR /usr/src/app
COPY package*.json ./
COPY *.lock ./
FROM node:16 AS builder

# Create app directory
WORKDIR /app

# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package.json ./
COPY yarn.lock ./

# Install app dependencies
RUN yarn install
COPY . .
RUN yarn run build
COPY dist ./dist

FROM node:16

WORKDIR /app

COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/yarn.lock ./
COPY --from=builder /app/dist ./dist

# create gen directories to store files
RUN mkdir -p ./gen/images ./gen/xlsx ./gen/xml ./gen/zip/extracted ./gen/zip/uploaded

RUN apt-get update -y \
&& apt-get install python3-pip -y \
&& pip3 install pyxform==1.10.1

CMD ["node", "dist/main"]
EXPOSE 3000
CMD [ "yarn", "run", "start:prod" ]
15 changes: 15 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.7'

services:
main:
container_name: quml2xform
image: samagragovernance/quml2xform:latest
ports:
- ${PORT}:3000
env_file:
- .env
volumes:
- gen:/app/gen

volumes:
gen:
13 changes: 3 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ services:
container_name: quml2xform
build:
context: .
target: development
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
ports:
- ${PORT}:${PORT}
command: yarn run start:dev
- ${PORT}:3000
env_file:
- .env
networks:
- webnet
networks:
webnet:
volumes:
- ./gen:/app/gen

0 comments on commit 6172121

Please sign in to comment.