-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72e5cad
commit 98b2963
Showing
5 changed files
with
108 additions
and
13 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
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM golang:1.20-alpine as builder | ||
|
||
# Set up apk dependencies | ||
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev curl ca-certificates build-base | ||
|
||
# Set working directory for the build | ||
WORKDIR /opt/app | ||
|
||
# Add source files | ||
COPY . . | ||
|
||
# Install minimum necessary dependencies, remove packages | ||
RUN apk add --no-cache $PACKAGES | ||
|
||
# For Private REPO | ||
ARG GH_TOKEN="" | ||
RUN go env -w GOPRIVATE="github.com/bnb-chain/*" | ||
RUN git config --global url."https://${GH_TOKEN}@github.com".insteadOf "https://github.com" | ||
|
||
RUN make build_server | ||
|
||
|
||
FROM alpine:3.17 | ||
|
||
ARG USER=app | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
|
||
ENV PACKAGES ca-certificates libstdc++ curl | ||
ENV WORKDIR=/app | ||
|
||
RUN apk add --no-cache $PACKAGES \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& addgroup -g ${USER_GID} ${USER} \ | ||
&& adduser -u ${USER_UID} -G ${USER} --shell /sbin/nologin --no-create-home -D ${USER} \ | ||
&& addgroup ${USER} tty \ | ||
&& sed -i -e "s/bin\/sh/bin\/bash/" /etc/passwd | ||
|
||
WORKDIR ${WORKDIR} | ||
RUN chown -R ${USER_UID}:${USER_GID} ${WORKDIR} | ||
USER ${USER_UID}:${USER_GID} | ||
|
||
ENV CONFIG_FILE_PATH /opt/app/config/config.json | ||
|
||
ENV WORKDIR=/app | ||
WORKDIR ${WORKDIR} | ||
COPY --from=builder /opt/app/build/blob-syncer-server ${WORKDIR} | ||
|
||
# Run the app | ||
CMD /app/blob-syncer-server --host 0.0.0.0 --port 8080 --config-path "$CONFIG_FILE_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 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
FROM golang:1.20-alpine as builder | ||
|
||
# Set up apk dependencies | ||
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev curl ca-certificates build-base | ||
|
||
# Set working directory for the build | ||
WORKDIR /opt/app | ||
|
||
# Add source files | ||
COPY . . | ||
|
||
# Install minimum necessary dependencies, remove packages | ||
RUN apk add --no-cache $PACKAGES | ||
|
||
# For Private REPO | ||
ARG GH_TOKEN="" | ||
RUN go env -w GOPRIVATE="github.com/bnb-chain/*" | ||
RUN git config --global url."https://${GH_TOKEN}@github.com".insteadOf "https://github.com" | ||
|
||
RUN make build_syncer | ||
|
||
|
||
FROM alpine:3.17 | ||
|
||
ARG USER=app | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
|
||
ENV PACKAGES ca-certificates libstdc++ curl | ||
ENV WORKDIR=/app | ||
|
||
RUN apk add --no-cache $PACKAGES \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& addgroup -g ${USER_GID} ${USER} \ | ||
&& adduser -u ${USER_UID} -G ${USER} --shell /sbin/nologin --no-create-home -D ${USER} \ | ||
&& addgroup ${USER} tty \ | ||
&& sed -i -e "s/bin\/sh/bin\/bash/" /etc/passwd | ||
|
||
WORKDIR ${WORKDIR} | ||
RUN chown -R ${USER_UID}:${USER_GID} ${WORKDIR} | ||
USER ${USER_UID}:${USER_GID} | ||
|
||
ENV CONFIG_FILE_PATH /opt/app/config/config.json | ||
|
||
ENV WORKDIR=/app | ||
WORKDIR ${WORKDIR} | ||
COPY --from=builder /opt/app/build/blob-syncer ${WORKDIR} | ||
|
||
# Run the app | ||
CMD /app/blob-syncer --config-path "$CONFIG_FILE_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