-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Third-Culture-Software/chore-build-with-do…
…cker chore: build with docker
- Loading branch information
Showing
38 changed files
with
128 additions
and
138 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
# define base image | ||
FROM node:lts-slim | ||
FROM node:lts | ||
|
||
# download all the missing dependencies for chromium, plus chromium itself | ||
# Install missing dependencies for chromium | ||
# These are all needed to make sure the browser can properly render all | ||
# the requiredd page | ||
RUN apt-get update && apt-get install -y \ | ||
ca-certificates fonts-liberation gconf-service \ | ||
libappindicator1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 \ | ||
libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 \ | ||
libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 \ | ||
libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 \ | ||
libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \ | ||
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \ | ||
libxss1 libxtst6 lsb-release libxshmfence1 chromium -y | ||
libxss1 libxtst6 lsb-release libxshmfence1 chromium -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# ENV NODE_ENV=production | ||
ENV YARN_VERSION 1.22.17 | ||
#ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1 | ||
RUN yarn policies set-version $YARN_VERSION | ||
#ENV CHROME_BIN /usr/bin/chromium | ||
#ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium | ||
|
||
# define working directory inside the container | ||
# Set working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy all the source code from host machine to the container project directory | ||
COPY . . | ||
# Copy source code | ||
COPY --chown=node:node . . | ||
|
||
# install all the dependencies | ||
RUN yarn --frozen-lockfile && yarn build | ||
# Install dependencies | ||
RUN npm install && \ | ||
NODE_ENV=production npm run build && \ | ||
npm install --omit=dev | ||
|
||
# yarn build creates the bin/ folder | ||
# Copy environment file to bin folder | ||
COPY .env bin/ | ||
|
||
# change directory to the bin diretory | ||
# Change directory to bin | ||
WORKDIR /usr/src/app/bin/ | ||
|
||
# make sure the node user is the owner of all the underlying files. | ||
# Set ownership | ||
RUN chown -R node:node * | ||
|
||
# ensure this container runs as the user "node" | ||
# Switch to non-root user | ||
USER node | ||
|
||
# define the start up command of the container to run the server | ||
ENV NODE_ENV production | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/third-Culture-Software/bhima | ||
LABEL org.opencontainers.image.description="A hospital information management application for rural Congolese hospitals" | ||
LABEL org.opencontainers.image.licenses=GPL | ||
|
||
# Define startup command | ||
CMD ["node", "server/app.js"] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,48 @@ | ||
version: '3' | ||
|
||
services: | ||
bhima: | ||
build: . | ||
image: imaworldhealth/bhima | ||
image: ghcr.io/third-culture-software/bhima | ||
restart: unless-stopped | ||
ports: | ||
- $PORT:$PORT | ||
environment: | ||
- REDIS_HOST=redis | ||
- DB_HOST=mysql | ||
- DB_USER=$DB_USER | ||
- DB_PASS=$DB_PASS | ||
depends_on: | ||
- mysql | ||
- redis | ||
networks: | ||
- backend | ||
|
||
mysql: | ||
image: mysql:8 | ||
restart: always | ||
image: mysql:8.3 # pin 8.3 ; https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c | ||
restart: unless-stopped | ||
command: | ||
- --default-authentication-plugin=mysql_native_password | ||
#- --mysql-native-password=ON # See https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c | ||
- --sql-mode=STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION | ||
- --character-set-server=utf8mb4 | ||
- --collation-server=utf8mb4_unicode_ci | ||
- --default-authentication-plugin=mysql_native_password | ||
volumes: | ||
- mysqldata:/var/lib/mysql/ | ||
- "./temp/docker-build.sql:/docker-entrypoint-initdb.d/bhima.sql" | ||
- ./server/models:/docker-entrypoint-initdb.d | ||
environment: | ||
- MYSQL_RANDOM_ROOT_PASSWORD=1 | ||
- MYSQL_RANDOM_ROOT_PASSWORD=yes | ||
- MYSQL_USER=$DB_USER | ||
- MYSQL_PASSWORD=$DB_PASS | ||
- MYSQL_DATABASE=$DB_NAME | ||
networks: | ||
- backend | ||
|
||
redis: | ||
image: redis:latest | ||
restart: always | ||
restart: unless-stopped | ||
networks: | ||
- backend | ||
|
||
networks: | ||
backend: | ||
|
||
volumes: | ||
mysqldata: | ||
|
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
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
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
Oops, something went wrong.