Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use Node.js version 14 as the base image
FROM node:14

# Set the working directory inside the container to /src
WORKDIR /src

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies using npm
RUN npm install

# Download the wait-for-it.sh script from the repository
RUN wget -O ./wait-for-it.sh https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh

# Make the wait-for-it.sh script executable
RUN chmod +x ./wait-for-it.sh

# Copy the index.js file to the working directory
COPY index.js ./

# Set the environment variable PORT to 3001
ENV PORT=3001

# Expose the specified port
EXPOSE $PORT

# Define the command to run the application after waiting for RabbitMQ to start
CMD ["sh", "-c", "./wait-for-it.sh my-rabbitmq:5672 --timeout=30 -- node index.js"]
10 changes: 10 additions & 0 deletions build_push_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Build Docker image
docker build -t ghcr.io/irvanfebri/shipping-service:latest .

# Log in to GitHub Container Registry
echo $GH_PACKAGES_TOKEN | docker login ghcr.io -u irvanfebri --password-stdin

# Push Docker image to GitHub Container Registry
docker push ghcr.io/irvanfebri/shipping-service:latest