Skip to content

Commit 6ec2585

Browse files
committed
Docker Fixed
1 parent 487762a commit 6ec2585

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

Diff for: js-docker/Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ RUN --mount=type=bind,source=client/package.json,target=package.json \
3030
# Copy the rest of the source files into the image.
3131
COPY ./client .
3232

33-
RUN cat /usr/src/app/vite.config.js
34-
3533
RUN npm run build
3634

3735
FROM node:${NODE_VERSION}-alpine as server

Diff for: js-docker/client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build --emptyOutDir --outDir ../server/public",
8+
"build": "vite build --emptyOutDir",
99
"preview": "vite preview"
1010
},
1111
"dependencies": {

Diff for: js-docker/server/db/password.txt

-1
This file was deleted.

Diff for: js-docker/server/routes/users.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var express = require('express');
22
var router = express.Router();
33

44
const pgp = require('pg-promise')(/* options */)
5-
const db = pgp('postgres://postgres:postgres@db:5432/postgres')
5+
const db = pgp('postgres://postgres:postgres@postgres:5432/postgres')
66

77

88
/* GET users listing. */

Diff for: py-docker/Dockerfile

+5-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
ARG NODE_VERSION=20
1010

11+
ARG PYTHON_VERSION=3.10.12
12+
1113
FROM node:${NODE_VERSION}-alpine as client
1214

1315
# Use production node environment by default.
@@ -30,11 +32,8 @@ RUN --mount=type=bind,source=client/package.json,target=package.json \
3032
# Copy the rest of the source files into the image.
3133
COPY ./client .
3234

33-
RUN cat /usr/src/app/vite.config.js
34-
3535
RUN npm run build
3636

37-
ARG PYTHON_VERSION=3.10.12
3837
FROM python:${PYTHON_VERSION}-slim as base
3938

4039
# Prevents Python from writing pyc files.
@@ -44,7 +43,7 @@ ENV PYTHONDONTWRITEBYTECODE=1
4443
# the application crashes without emitting any logs due to buffering.
4544
ENV PYTHONUNBUFFERED=1
4645

47-
WORKDIR /app
46+
WORKDIR /usr/src/app
4847

4948
# Create a non-privileged user that the app will run under.
5049
# See https://docs.docker.com/go/dockerfile-user-best-practices/
@@ -63,14 +62,14 @@ RUN adduser \
6362
# Leverage a bind mount to requirements.txt to avoid having to copy them into
6463
# into this layer.
6564
RUN --mount=type=cache,target=/root/.cache/pip \
66-
--mount=type=bind,source=requirements.txt,target=requirements.txt \
65+
--mount=type=bind,source=server/requirements.txt,target=requirements.txt \
6766
python -m pip install -r requirements.txt
6867

6968
# Switch to the non-privileged user to run the application.
7069
USER appuser
7170

7271
# Copy the source code into the container.
73-
COPY . .
72+
COPY ./server .
7473

7574
COPY --from=client /usr/src/app/dist ./public
7675

Diff for: py-docker/client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build --emptyOutDir --outDir ../server/public",
8+
"build": "vite build --emptyOutDir",
99
"preview": "vite preview"
1010
},
1111
"dependencies": {

Diff for: py-docker/docker-compose.yml

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# https://github.com/compose-spec/compose-spec/blob/master/spec.md
33
services:
44

5+
server:
6+
build:
7+
context: .
8+
container_name: py-server
9+
ports:
10+
- 5001:5001
11+
512
postgres:
613
# ***************************************************************************
714
# Postgres Database

Diff for: py-docker/server/db/password.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)