Skip to content

Commit 9b00dda

Browse files
committed
cleanup docker files
1 parent bab7905 commit 9b00dda

2 files changed

Lines changed: 33 additions & 36 deletions

File tree

docker-builds/server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM --platform=amd64 487920318758.dkr.ecr.eu-central-1.amazonaws.com/cljs-web3-ci:node-20.18.1 as builder
2-
ARG ETHLANCE_ENV=prod
2+
ARG ETHLANCE_ENV
33
ARG ETHLANCE_DEPLOY_SEED
44
USER root
55

docker-builds/ui/Dockerfile

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,49 @@
1-
FROM --platform=amd64 487920318758.dkr.ecr.us-west-2.amazonaws.com/cljs-web3-ci:node-20.18.1 as init
2-
ARG BUILD_ENV=qa
3-
ARG ETHLANCE_DEPLOY_SEED="sign bachelor state zoo expire boat morning situate scene unveil oven crew"
1+
FROM --platform=amd64 487920318758.dkr.ecr.eu-central-1.amazonaws.com/cljs-web3-ci:node-20.18.1 as builder
2+
ARG ETHLANCE_ENV
3+
ARG ETHLANCE_DEPLOY_SEED
44
USER root
55

6-
ENV ETHLANCE_COMPONENT="ui"
7-
ENV ETHLANCE_SOURCE_ROOT=/build/ethlance
8-
ENV ETHLANCE_SERVER_ROOT=/build/ethlance/server
9-
ENV ETHLANCE_ENV=$BUILD_ENV
10-
ENV DEPLOY_TARGET=/deploy/
11-
ENV ETHLANCE_DEPLOY_SEED="${ETHLANCE_DEPLOY_SEED}"
12-
ENV SMART_CONTRACTS_PATH="/build/ethlance/shared/src/ethlance/shared/smart_contracts_${BUILD_ENV}.cljs"
13-
ENV SMART_CONTRACTS_BUILD_PATH="/build/ethlance/resources/public/contracts/build"
14-
ENV ETHLANCE_CONFIG_PATH="/build/ethlance/config/${ETHLANCE_COMPONENT}-config-${BUILD_ENV}.edn"
15-
16-
WORKDIR /build/ethlance
6+
# Set environment variables
7+
ENV ETHLANCE_SOURCE_ROOT=/build/ethlance \
8+
ETHLANCE_ENV=$ETHLANCE_ENV
9+
ENV ETHLANCE_SERVER_ROOT=${ETHLANCE_SOURCE_ROOT}/server \
10+
ETHLANCE_DEPLOY_SEED=${ETHLANCE_DEPLOY_SEED} \
11+
SMART_CONTRACTS_BUILD_PATH="${ETHLANCE_SOURCE_ROOT}/resources/public/contracts/build" \
12+
SMART_CONTRACTS_PATH="${ETHLANCE_SOURCE_ROOT}/shared/src/ethlance/shared/smart_contracts_${ETHLANCE_ENV}.cljs" \
13+
ETHLANCE_CONFIG_PATH="${ETHLANCE_SOURCE_ROOT}/config/server-config-${ETHLANCE_ENV}.edn" \
14+
UI_CONFIG_PATH="${ETHLANCE_SOURCE_ROOT}/config/ui-config-${ETHLANCE_ENV}.edn"
15+
16+
# Set working directory and prepare source files
17+
WORKDIR ${ETHLANCE_SOURCE_ROOT}
1718
COPY . .
19+
COPY ethlance-config/config "${ETHLANCE_SOURCE_ROOT}/config"
1820

19-
RUN cat "${SMART_CONTRACTS_PATH}"
21+
# Clone required dependencies
22+
RUN git clone --depth 1 https://github.com/district0x/d0x-libs /build/d0x-libs
2023

21-
# WORKDIR /build/ethlance-config
22-
# COPY config .
24+
# Build stage - compile contracts and UI
25+
# Compile contracts
26+
RUN yarn install && ETHLANCE_ENV="${ETHLANCE_ENV}" npx truffle compile
2327

24-
WORKDIR /build
25-
COPY ethlance-config/config /build/ethlance/config
26-
RUN git clone https://github.com/district0x/d0x-libs
27-
28-
29-
ARG BUILD_ENV=qa
30-
ARG ETHLANCE_ENV=qa
31-
FROM init as build_stage
32-
ENV ETHLANCE_ENV=qa
33-
WORKDIR $ETHLANCE_SOURCE_ROOT
34-
RUN yarn install && ETHLANCE_ENV="${BUILD_ENV}" npx truffle compile
35-
36-
WORKDIR $ETHLANCE_SOURCE_ROOT/ui
28+
# Build UI components
29+
WORKDIR ${ETHLANCE_SOURCE_ROOT}/ui
3730
RUN yarn install && \
38-
ETHLANCE_ENV="${BUILD_ENV}" npx shadow-cljs release dev-ui && \
31+
ETHLANCE_ENV="${ETHLANCE_ENV}" npx shadow-cljs release dev-ui && \
3932
./node_modules/less/bin/lessc resources/public/less/main.less resources/public/css/main.css --verbose
4033

34+
# Final stage - using nginx to serve the UI
4135
FROM nginx:alpine
42-
ENV ETHLANCE_ENV=qa
36+
ARG ETHLANCE_ENV
37+
ENV ETHLANCE_ENV=$ETHLANCE_ENV
4338

39+
# Configure nginx
4440
COPY docker-builds/ui/ethlance.conf /etc/nginx/conf.d/
4541
COPY docker-builds/ui/default.conf /etc/nginx/conf.d/default.conf
4642
COPY docker-builds/ui/nginx.conf /etc/nginx/nginx.conf
4743

48-
COPY --from=build_stage /build/ethlance/resources /deploy/resources
49-
COPY --from=build_stage /build/ethlance/resources/public/contracts /deploy/ui/contracts/
50-
COPY --from=build_stage /build/ethlance/ui/resources/public /deploy/ui/
44+
# Copy built assets from builder stage
45+
COPY --from=builder /build/ethlance/resources /deploy/resources
46+
COPY --from=builder /build/ethlance/resources/public/contracts /deploy/ui/contracts/
47+
COPY --from=builder /build/ethlance/ui/resources/public /deploy/ui/
5148

5249
EXPOSE 80

0 commit comments

Comments
 (0)