Skip to content

Commit

Permalink
install packages for contracts, and general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Oct 7, 2024
1 parent 609e2ec commit 03a43b5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 76 deletions.
46 changes: 29 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
# Build the Go binary in a separate stage utilizing Makefile
# Build stage
FROM golang:1.22 AS builder

# Install necessary packages for the final image
WORKDIR /app

# Install Node.js and Yarn
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl sudo gpg lsb-release software-properties-common \
curl gpg \
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg \
&& apt remove cmdtest \
&& echo "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y git yarn apt-utils
&& apt-get install -y nodejs \
&& npm install -g yarn

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
# Copy the entire project
COPY . .

# Install contract dependencies
RUN cd contracts && yarn install

# Build the Go binary
RUN make build

# Use the official Ubuntu 22.04 image as a base for the final image
FROM ubuntu:22.04 AS base
# Final stage
FROM ubuntu:22.04

# Install necessary packages
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
nodejs npm \
&& npm install -g yarn

# Create the 'masa' user and set up the home directory
RUN useradd -m -s /bin/bash masa && \
mkdir -p /home/masa/.masa && \
chown -R masa:masa /home/masa

# Copy the built binary and set permissions
COPY --from=builder /app/bin/masa-node /usr/bin/masa-node
RUN chmod +x /usr/bin/masa-node

# Create the 'masa' user and set up the home directory
RUN useradd -m -s /bin/bash masa && mkdir -p /home/masa/.masa && chown -R masa:masa /home/masa
# Copy contracts directory including node_modules
COPY --from=builder --chown=masa:masa /app/contracts /home/masa/contracts

# Switch to user 'masa' for following commands
USER masa
WORKDIR /home/masa

# Copy the .env file into the container
# Copy the .env file
COPY --chown=masa:masa .env .

# Expose necessary ports
EXPOSE 4001 8080

# Set default command to start the Go application

# Set default command to start the MASA node
CMD /usr/bin/masa-node --bootnodes="$BOOTNODES" --env="$ENV" --validator="$VALIDATOR" --cachePath="$CACHE_PATH"
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ services:
FILE_PATH: "${FILE_PATH}"
VALIDATOR: "${VALIDATOR}"
CACHE_PATH: "${CACHE_PATH}"
TWITTER_PASS: "${TWITTER_PASS}"
TWITTER_USER: "${TWITTER_USER}"
TWITTER_PASSWORD: "${TWITTER_PASSWORD}"
TWITTER_USERNAME: "${TWITTER_USERNAME}"
TWITTER_2FA_CODE: "${TWITTER_2FA_CODE}"
TWITTER_SCRAPER: "${TWITTER_SCRAPER}"
volumes:
Expand Down
57 changes: 0 additions & 57 deletions node-install.sh

This file was deleted.

0 comments on commit 03a43b5

Please sign in to comment.