-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install packages for contracts, and general cleanup
- Loading branch information
1 parent
609e2ec
commit 03a43b5
Showing
3 changed files
with
31 additions
and
76 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
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" |
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 was deleted.
Oops, something went wrong.