Reputation: 774
I am new to Openshift Container Platform. I am trying to deploy my application which uses node, redis and mongo. I have written a Dockerfile and docker-compose.yml. I am able to run it successfully in local system. Challenge I am facing is deploying in Openshift. Below are my Dockerfile and docker-compose.yml:
Dockerfile:
# Install node v10
FROM node:10.16.3
RUN apt update && apt install -y openjdk-8-jdk
# Set the workdir /var/www/myapp
WORKDIR /var/www/myapp
# Copy the package.json to workdir
COPY package.json .
# Run npm install - install the npm dependencies
RUN npm install
# Copy application source
COPY . .
# Copy .env.docker to workdir/.env - use the docker env
#COPY .env.docker ./.env
# Expose application ports - (4300 - for API and 4301 - for front end)
# EXPOSE 4300 4301
EXPOSE 52000
CMD node app.js
docker-compose.yml:
version: '3'
services:
myapp:
container_name: myapp
restart: always
build: .
ports:
- '52000:52000'
# - '8080:8080'
# - '4300:4300'
# - '4301:4301'
links:
- redis
- mongo
mongo:
container_name: myapp-mongo
image: 'mongo:4'
ports:
- '28107:28107'
# - '27017:27017'
redis:
container_name: myapp-redis
image: 'redis:4.0.11'
ports:
- '6379:6379'
Upvotes: 0
Views: 1771
Reputation: 161
You can use Docker Swarm. If you are more familiar with docker-compose, Have a look it this it might help (https://docs.docker.com/engine/swarm/stack-deploy/).
Upvotes: 1
Reputation: 657
You could use kompose (https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/) to translate your docker-compose resource to k8s manifests. I don't think you can deploy compose files directly without usage of other tools first.
Upvotes: 2