Skip to content

Commit

Permalink
fix docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sdankel committed Mar 16, 2024
1 parent 1ec228a commit fda0c72
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ target
build
node_modules
tmp
projects
.vscode/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cargo run
Alternatively, it can be run locally with Docker, as it is in the deployed environment.

```sh
docker build -f deployment .
docker build -f deployment/Dockerfile .
docker run -p 8080:8080 -d <image-sha>
```

Expand Down
4 changes: 2 additions & 2 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useCompile } from './features/editor/hooks/useCompile';
import { DeployState } from './utils/types';
import {
loadSolidityCode,
loadSwayCode as loadSwayCode,
loadSwayCode,
saveSolidityCode,
saveSwayCode,
} from './utils/localStorage';
Expand Down Expand Up @@ -93,7 +93,7 @@ function App() {
} else {
setCodeToCompile(swayCode);
}
}, [showSolidity, swayCode, solidityCode, setCodeToCompile, updateLog]);
}, [showSolidity, swayCode, solidityCode, setCodeToCompile, setCodeToTranspile]);

useTranspile(
codeToTranspile,
Expand Down
2 changes: 1 addition & 1 deletion app/src/features/editor/components/EditorView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import React from 'react';
import SolidityEditor from './SolidityEditor';
import SwayEditor from './SwayEditor';
import { Toolchain } from './ToolchainDropdown';
Expand Down
15 changes: 9 additions & 6 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Stage 1: Build
FROM lukemathwalker/cargo-chef:latest-rust-1.70 as chef
FROM lukemathwalker/cargo-chef:latest-rust-1.76 as chef
WORKDIR /build/
# hadolint ignore=DL3008

RUN apt-get update && \
apt-get install -y --no-install-recommends \
lld \
Expand All @@ -10,12 +11,17 @@ RUN apt-get update && \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Build sway-playground
FROM chef as planner
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM chef as builder

# Install charcoal
RUN cargo install --git https://github.com/camden-smallwood/charcoal.git --rev f6338bf318500dd6977af813c37f66c504925c44

ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY --from=planner /build/recipe.json recipe.json
# Build our project dependecies, not our application!
Expand All @@ -41,10 +47,11 @@ COPY --from=builder /build/target/debug/sway-playground .
COPY --from=builder /build/target/debug/sway-playground.d .
COPY --from=builder /build/Rocket.toml .
COPY --from=builder /build/projects projects
COPY --from=builder /usr/local/cargo/bin/charcoal /bin

# Install fuelup
RUN curl -fsSL https://install.fuel.network/ | sh -s -- --no-modify-path
ENV PATH="/root/.fuelup/bin:$HOME/.cargo/bin:$PATH"
ENV PATH="/root/.fuelup/bin:$PATH"

# Install all fuel toolchains
RUN fuelup toolchain install latest
Expand All @@ -55,10 +62,6 @@ RUN fuelup toolchain install beta-3
RUN fuelup toolchain install beta-4
RUN fuelup toolchain install beta-5

# Install charcoal
RUN git clone https://github.com/camden-smallwood/charcoal.git
RUN cargo install --path charcoal

EXPOSE 8080

CMD ["./sway-playground"]

0 comments on commit fda0c72

Please sign in to comment.