Skip to content

Commit

Permalink
fix dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinfuchs committed Oct 19, 2023
1 parent 2ec3d97 commit 391c041
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
31 changes: 22 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
FROM node:slim
FROM golang:latest as builder
WORKDIR /root/
COPY . .

# Install NodeJS (https://github.com/nodesource/distributions#installation-instructions)
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg build-essential
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

RUN apt-get update
RUN apt-get -y install nodejs

# Install yarn
RUN npm install -g yarn

# Build site
RUN cd embedg-site && yarn install && yarn build && cd ..

# Build app
RUN cd embedg-app && yarn install && yarn build && cd ..

# Build backend
RUN apt-get update
RUN apt-get install -y build-essential curl
RUN curl -OL https://golang.org/dl/go1.20.4.linux-amd64.tar.gz
RUN tar -C /usr/local -xvf go1.20.4.linux-amd64.tar.gz
ENV PATH=$PATH:/usr/local/go/bin
RUN cd embedg-server && go build --tags "embedapp embedsite" && cd ..

FROM debian:bullseye-slim
FROM debian:stable-slim
WORKDIR /root/
COPY --from=0 /root/embedg-server/embedg-server ./
COPY --from=builder /root/embedg-server/embedg-server .

RUN apt-get update
RUN apt-get install -y ca-certificates gnupg build-essential

EXPOSE 8080
CMD ["./embedg-server"]
CMD ./embedg-server migrate postgres up; ./embedg-server server
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ yarn build

### Build the server (backend)

Install Go from [go.dev](https://go.dev/doc/install).
Install Go `>=1.21` from [go.dev](https://go.dev/doc/install).

```sh
# Switch to the backend directory
Expand Down

0 comments on commit 391c041

Please sign in to comment.