Skip to content

Commit

Permalink
Initial Podman Container implementation
Browse files Browse the repository at this point in the history
Added a containerfile for building a podman server container.
Added a dockerignore for the files not needed for running the server.
Added an install script for installing all podman containers.
  • Loading branch information
chrsrns committed Feb 5, 2024
1 parent f696225 commit c4d5e44
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change this as necessary for your own project(s)
Containerfile*
README.md
node_modules
*/node_modules
*.log
.dockerignore
.env*
mysqldata*
.vscode
.github
.git
11 changes: 11 additions & 0 deletions Containerfile.database
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM mysql/mysql-server:latest as base

VOLUME ./mysqldata /var/lib/mysql

ENV MYSQL_ROOT_PASSWORD=root_pw
ENV MYSQL_ROOT_HOST=%
ENV MYSQL_USER=infodb_user
ENV MYSQL_PASSWORD=infodb_pw_123
ENV MYSQL_DATABASE=infodb

EXPOSE 3306
27 changes: 27 additions & 0 deletions Containerfile.server
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:alpine as base

WORKDIR /usr/src/app

# Copy in package.json and package-lock.json
COPY --chown=1001:1001 package*.json ./

# Install dependencies and devDependencies
RUN npm ci --omit=dev

# Copy in source code and other assets
COPY --chown=1001:1001 . .

# Compile the source TS into JS files
# RUN npm run build:ts

# Configure fastify behaviour, and NODE_ENV
ENV NODE_ENV=production
ENV JWT_ACCESS_SECRET=SECRET123
ENV JWT_REFRESH_SECRET=ANOTHER_SECRET123
ENV DATABASE_URL=mysql://infodb_user:infodb_pw_123@localhost:3306/infodb

EXPOSE 3000

RUN npx prisma generate

CMD ["npm", "run", "start:migrate"]
7 changes: 7 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
podman pod create --name scheduler-demo-pod --publish=3306:3306,3000:3000 &&
podman build . -f ./Containerfile.server -t scheduler-demo-server &&
podman build . -f ./Containerfile.database -t scheduler-demo-db &&

podman run -dit --pod=scheduler-demo-pod --name=scheduler-demo-db-1 scheduler-demo-db:latest &&
podman run -dit --pod=scheduler-demo-pod --name=scheduler-demo-server-1 scheduler-demo-server:latest

0 comments on commit c4d5e44

Please sign in to comment.