-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile
executable file
·50 lines (37 loc) · 1.44 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
FROM --platform=$BUILDPLATFORM swift:5.7-jammy
LABEL maintainer="[email protected]"
LABEL Description="SwiftPlayground.run docker image"
WORKDIR /swiftplayground
# We can replace this port with what the user wants
EXPOSE 8080
# Default user if not provided
ARG bx_dev_user=root
ARG bx_dev_userid=1000
SHELL ["/bin/bash", "-c"]
# Install system level packages
RUN apt-get update
# Create user if not root
RUN if [ $bx_dev_user != "root" ]; then useradd -ms /bin/bash -u $bx_dev_userid $bx_dev_user; fi
# Bundle application source & binaries
COPY . /swiftplayground
# Install dependencies
RUN apt-get -qq -y install libz-dev curl build-essential libssl-dev libsqlite3-dev python3
# NVM
ENV NODE_VERSION 16.17.0
ENV NVM_DIR /usr/local/nvm
RUN mkdir /usr/local/nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# install node and npm
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH:node_modules/.bin
# Bootstrap
RUN ./bootstrap.sh
# Command to start Swift application
# CMD export PATH="$PATH:node_modules/.bin"
# CMD export NVM_DIR="$HOME/.nvm"
# CMD $NVM_DIR/nvm.sh
CMD Toolchains/swift-5.7-RELEASE.xctoolchain/usr/bin/swift run -c release --scratch-path .build/swift-5.7-RELEASE PlaygroundServer serve --hostname 0.0.0.0