forked from zephinzer/cloudshell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (50 loc) · 1.29 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
51
52
53
54
55
56
# Copyright (c) 2022 Arduino.cc
#
# Based on https://github.com/bcmi-labs/cloudshell
#
# License: MIT
# Examples:
# docker build --tag "cloudshell:latest" .
# docker run -p 8000:8000 -it --rm --user "63" -it cloudshell:latest
FROM golang:1.16-alpine AS backend
LABEL maintainer="Massimo Pennazio <maxipenna@libero.it>"
WORKDIR /go/src/cloudshell
COPY ./cmd ./cmd
COPY ./internal ./internal
COPY ./pkg ./pkg
COPY ./go.mod .
COPY ./go.sum .
ENV CGO_ENABLED=0
RUN go mod vendor
ARG VERSION_INFO=dev-build
RUN go build -a -v \
-ldflags " \
-s -w \
-extldflags 'static' \
-X main.VersionInfo='${VERSION_INFO}' \
" \
-o ./bin/cloudshell \
./cmd/cloudshell
FROM node:16.0.0-alpine AS frontend
WORKDIR /app
COPY ./package.json .
COPY ./package-lock.json .
RUN npm install
FROM alpine:3.14.0
WORKDIR /app
RUN apk add --no-cache bash ncurses
COPY --from=backend /go/src/cloudshell/bin/cloudshell /app/cloudshell
COPY --from=frontend /app/node_modules /app/node_modules
COPY ./public /app/public
RUN ln -s /app/cloudshell /usr/bin/cloudshell
RUN adduser -D -u 1000 user
RUN mkdir -p /home/user
RUN chown user:user /app -R
WORKDIR /
ENV WORKDIR=/app
ENV LOG_LEVEL="trace"
ENV ALLOWED_HOSTNAMES="portenta-x8.local"
ENV SERVER_PORT="8000"
ENV SERVER_ADDRESS="192.168.7.1"
USER user
ENTRYPOINT ["/app/cloudshell"]